O
Orion93
Hi!
I try to make an interface for this script in Perl/Tk but it's the first
time i try to do it and i don't know how to use my variable in the sub. The
script below doesn't work and i don't know why! Please, i need help!
Thanks
use Tk;
$main = MainWindow -> new;
$main->title("Test 1");
$libelF=$main->Label(-text=>'Chemin:')->pack();
$montantF->Entry(-textvariable=>\$nomFic)->pack(-padx=>5);
$valid=$main->Button(-text=>'Ok',-command=>\&recupPages)->pack(-
side=>'left', expand=>1);
$end=$main->Button(-text=>'Fermer',-command=>sub {exit})->pack(-
side=>'right', expand=>1);
MainLoop();
sub recupPages
{
my $rep= $montantF->get();
my $result = shift;
open(F,'$nomFic');
open(SORTIE,'$result');
$i = 0;
while(<F>)
{
$i ++;
}
print SORTIE " $nomFic $i\n";
close F;
close SORTIE;
}
my $emplacement = $nomFic;
my $ficResultat = "e:\\result.txt";
recupPages($_, $ficResultat) for glob '$nomFic';
I try to make an interface for this script in Perl/Tk but it's the first
time i try to do it and i don't know how to use my variable in the sub. The
script below doesn't work and i don't know why! Please, i need help!
Thanks
use Tk;
$main = MainWindow -> new;
$main->title("Test 1");
$libelF=$main->Label(-text=>'Chemin:')->pack();
$montantF->Entry(-textvariable=>\$nomFic)->pack(-padx=>5);
$valid=$main->Button(-text=>'Ok',-command=>\&recupPages)->pack(-
side=>'left', expand=>1);
$end=$main->Button(-text=>'Fermer',-command=>sub {exit})->pack(-
side=>'right', expand=>1);
MainLoop();
sub recupPages
{
my $rep= $montantF->get();
my $result = shift;
open(F,'$nomFic');
open(SORTIE,'$result');
$i = 0;
while(<F>)
{
$i ++;
}
print SORTIE " $nomFic $i\n";
close F;
close SORTIE;
}
my $emplacement = $nomFic;
my $ficResultat = "e:\\result.txt";
recupPages($_, $ficResultat) for glob '$nomFic';