|XP is just a number|
Re^6: chop vs chompby Moron (Curate)
|on May 14, 2007 at 09:58 UTC||Need Help??|
It's narrower than that: the only situation where it is reasonable to use chomp() is where:
1) the format of the records is delimited rather than fixed width.
2) the absence of a trailing line terminator on the last line is permissible; usually because the file has been manually created.
3) the only whitespace permitted at the end of the line is the carriage return - otherwise you wouldn't do it, you'd pattern-match.
(Update: I mean of course to say: where all three conditions apply rather than just a subset of them)
Such conditions are clearly exceptional rather than the rule, yet replies to this thread confirm my suspicion that people tend to assume their use of chomp() can be assumed as being in response to a "normal" textfile case.
^M Free your mind!