commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morgan Delagrange <>
Subject Re: [lang] chop and chomp
Date Wed, 05 Mar 2003 20:59:28 GMT

--- Alex Chaffee / Purple Technology <>
> Perl:
> chop removes the final character, no matter what it
> is
> chomp removes the final character if and only if
> it's a newline
> (or, technically, the $INPUT_RECORD_SEPARATOR).

Technically, that's incorrect.  Perl's chomp command
deletes all consecutive substrings matching the
$INPUT_RECORD_SEPARATOR from the end of the string. 
Chomp returns the number of substrings deleted, while
chop returns the character deleted.  I believe that
Perl chop magic considers /r/n to be a single
character, but I'm not positive.

- Morgan

Morgan Delagrange

Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message