Hello monks , I am new to perl and this site :
my question is , I have the following file which I am reading :
[PASSWORDS]
GUY ddd
GIRL dfd33
BOY df341
I am reading it as follow
my @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);
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 ,,, thanks