more useful options | |
PerlMonks |
Re^8: Filtering Output from two filesby roboticus (Chancellor) |
on Feb 06, 2018 at 08:47 UTC ( [id://1208547]=note: print w/replies, xml ) | Need Help?? |
You have an error in this line:
Since $row is in parenthesis, you're doing an assignment in list context. So all the lines in $fh2 are read, and the first one is passed into $row, and the rest are discarded. Change the line to:
and then it should work better for you. Here's a little demonstration:
Notice that we read the first line in scalar context, and then we print the first line successfully. Next, we read a line in array context, and print the second line successfully. Finally, we try to read the next line, but there's no data left! All of it was read earlier! ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|