|
|
| We don't bite newbies here... much | |
| PerlMonks |
Re^2: error printing all text in text fileby Marshall (Canon) |
| on Jan 13, 2022 at 05:38 UTC ( [id://11140414]=note: print w/replies, xml ) | Need Help?? |
|
There are multiple problems with this snippet.
Assuming that the last line is terminated properly, after all data is read from the filehandle, $line will be undefined. chomp won't like that and will barf. Now if the last line of the file is not terminated, an even more insidious thing can happen. That last line will be ignored because chomp does not remove any characters from that line.
So, don't use this construct.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||