How to pass a filename or a filehandle, two arrays to a function?
I have done this:
open INPUT,"$old";
my (@arrayold,@arraynew);
myfunc(*INPUT,\@arrayold,\@arraynew)
sub myfunc {
my ($file,@array1,@array2) = @_ ;
my $j = 0;
my $k = 0;
while (my $line = <$file)
{ my($word1,$word2) = split(",",$line);
$array[$j++] = $word1;
$array[$k++] = $word2;
}
}
As you can guess, my function reads a file which has info like:
1,//http:abcd
2,//http:avcd
into two arrays one containing the number and the other containing the address.
I am only getting blank arrays.
Am I passing it wrong?
Kindly help.