On Wed, 12 Dec 2001, Andre` Niel Cameron wrote:
> I have a pain in the butt array that SOMETIMES has a CR at the end and
> sometimes does not. Can anyone think of a way to test to see if the \n is
> there and if it is then chop else no chop? Cause if I just use chop then it
> starts chopping off letters sometimes...
Don't use chop, use chomp. It does exactly what you want -- technically,
it chops off $?, which by default is \n, but doesn't chop it if it's not
there. You can test the return value of chomp to see how many characters
it removed.
perldoc -f chomp
-- Brett
http://www.chapelperilous.net/
------------------------------------------------------------------------
Some people manage by the book, even though they don't know who wrote the
book or even what book.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]