hi all,
i need setup constant hash generated from file, if it is possible.
i have following code:
my %testerscfg = ();
sub get_testerconfig {
open(TESTERCONFIG,"@{[TESTERCFG]}") or die "@{[TESTERCFG]} doesn't exists
or isn't readable!\n";
# loop while testers file contain a line
while (my $myline = <TESTERCONFIG>) {
chomp($myline);
my @cfgfields = split(/\t/,$myline);
$testerscfg{$cfgfields[0]} = [EMAIL PROTECTED];
}
close(TESTERCONFIG);
return 0;
}
get_testerconfig();
use constant TESTERCONFIG => %testerscfg;
foreach $b (keys %testerscfg) {
print $b."\n";
}
it works well, but when i put in foreach loop instead of %testerscfg
TESTERCONFIG
i got following:
Type of arg 1 to keys must be hash (not subroutine entry) at testik.pl line
52, near "TESTERCONFIG) "
question is: how to setup hash constant from file?
thanks for advice or help.
best regards
jiri kastner
______________________________________
Superrychlý internet ADSL 512 od TISCALI již od 295 Kč měsíčně !
http://sluzby.tiscali.cz/domacnosti/adsl/adsl-512-promo.php?r=pb
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/