Having established completeness of a file, the only way a record can lose its "\n" unexpectedly is by means of a programming error, such as making a conditional substitution that happens implicitly to remove it but only where the pattern matches.You are apparently unfamiliar with the idea that Unix files can have a missing newline at the end. As a programmer, I must deal with files like that.
Are you suggesting that instead of writing a simple chomp in each program that reads possibly-newline-terminated strings, I explictly put the code in there for that? I hope not. If Perl were that way, I'd be quickly writing "randalchomp" that acts like chomp does now, and figure out a way to include it in every program.
Chomp is there because it perfectly fills a need. That's why we use it.
In reply to Re: chop vs chomp
by merlyn
in thread chop vs chomp
by Moron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |