Hello Monks,
I am reading a file and then putting it into an array but resulted array has always 1st line of file missing.
Here is my code
my $file = 'filename.txt'; my @2comp; open (my $fh, '<', $file) or die "cant open : $!"; while(<$fh>) { @2comp = <$fh>; } close $fh; @2comp = sort(@2comp); print "@2comp";
file "filename.txt" has 2 lines but array will show only second. i put more lines in file and i see that always first line of file is missing
What wrong i am doing? -KAKA-
In reply to reading a file, put into array. Missing first line by kaka_2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |