in reply to When do you use chop instead of chomp?
chop always takes off the last character of a string and returns that character.
chomp takes off any and all trailing newlines, but leaves the string alone if there are no newlines. It returns the number of characters removed. $/ determines what chomp thinks is a newline. So you can local that to remove newlines from files from other systems that have different newlines than your native OS.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: When do you use chop insetad of comp?
by dvergin (Monsignor) on Mar 02, 2002 at 20:22 UTC | |
by steves (Curate) on Mar 03, 2002 at 02:12 UTC |