Hello,

I am trying to read data from a series of files as
references into an array. Every element of my array is
a reference to another array containing the values in
one of the files.

Here is my code:
#!/usr/bin/perl
print "enter the number of parameters ";
chomp($num_par=<STDIN>);
for ($i=0;$i<$num_par;$i++)
{
print "filename? ";
chomp($file=<STDIN>);
open IN,$file or die "Cannot open $file for read.\n
Error:$!";
@temp=<IN>;
close(IN);
push (@ar,\@temp);
{print "@{$ar[$i]} \n ";}
}
print"output\n";
for ($i=0;$i<$num_par;$i++)
{print "@{$ar[$i]} \n\n ";}

This code does not work correctly, but when I add a
"my" before @temp it works fine. I understand that
"my" declares a local variable....but I don't
understand how this will affect the way values are
assigned in my array. Any ideas?

Thanks,
Teju

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

Reply via email to