Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks , I am new to perl and this site :
my question is , I have the following file which I am reading :
I am reading it as follow[PASSWORDS] GUY ddd GIRL dfd33 BOY df341
What I am trying tod do is after getting the passwords , store it into the array that is declared outside the open statment, when I try to store it into the array , it says it is not declare and when I declare it inside , it can't see it outside that loop. I just want to have all the passwords stored in a global array in the order it was read from the config file so I can pass that array to a different subs inside my program. I hope I am clear ,,, thanksmy @listOfPass; open(INPUT , "<$input_file" ) or die "couldn't open"; my ($section,%passwds); while(<CONFILE>) { chomp; if (/^\[(.*?)\]$/) { $section = $1; next; } if ($section eq 'PASSWORDS') { my ($mkt,$pass) = split; $passwds{$mkt} = $pass; $passwds{$pass} = $mkt; @listOfPass = "$pass"; # <------ not working :(( }#end while loop close (INPUT);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Array issue
by Ovid (Cardinal) on Jan 28, 2004 at 20:24 UTC | |
Re: Array issue
by ysth (Canon) on Jan 28, 2004 at 20:22 UTC | |
Re: Array issue
by monktim (Friar) on Jan 28, 2004 at 20:32 UTC | |
Re: Array issue
by Theo (Priest) on Jan 28, 2004 at 20:20 UTC | |
Re: Array issue
by Benedictus (Beadle) on Jan 28, 2004 at 20:27 UTC | |
Re: Array issue
by pelagic (Priest) on Jan 28, 2004 at 20:31 UTC |
Back to
Seekers of Perl Wisdom