No it still works with chomp
To understand why this works, take a look at the return value for chomp. Hint: it's not the string with newlines missing.
The problem with while (my $line = <DATA>) {} is real, it's just obscure. As hinted, it only happens when you get a line with a false value and no newline. Sometimes this happens at the end of a file. Sometimes it happens for other reasons. It usually doesn't cause any actual problems, but certainly is something to look out for.
In reply to Re^5: A refactoring trap
by revdiablo
in thread A refactoring trap
by gmax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |