Perl Monk, Perl Meditation | |
PerlMonks |
Re: How to handle the error when we try to read an empty text file in perlby BrowserUk (Patriarch) |
on Jan 28, 2015 at 08:02 UTC ( [id://1114717]=note: print w/replies, xml ) | Need Help?? |
The problem is when i try to read a file which is empty then it crashes (because the code try to read a file and it find nothing in the first line and code breaks with an error that couldnt open this file). That makes no sense. If the file is empty the while loop will never be entered:
BTW, this is also nonsense:
Iterating a foreach over a single scalar variable, means it will only ever iterate once. Ie. it is completely redundant. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
In Section
Seekers of Perl Wisdom
|
|