[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

% with perl



hello,
this script runs fine:

#!/usr/local/bin/perl

print "\n\n";
%loginpsswd=("gerard","12345678","jaimie","78945612","andy","45632178");
  
 print $loginpsswd{"gerard"};
 print "\n\n";
 print $loginpsswd{"jaimie"};
 print "\n\n";
 print $loginpsswd{"toto"};
 print "\n\n";
 
 
but when instead of the six last lines I write:

$i=0;
while ($i<3)
{
print $loginpsswd{"$loginpasswd[2*$i]"};  
print "\n\n";
}
I get error ...

can someone whose knows perl explain me how to write
this loop correctly.

TIA 
-- 
Gerard



Reply to: