Perl: the Markov chain saw | |
PerlMonks |
(Ovid) Re: How do you chomp your chomps?by Ovid (Cardinal) |
on Jan 09, 2001 at 03:02 UTC ( [id://50592]=note: print w/replies, xml ) | Need Help?? |
Personally, I have never used the return value from chomp, but that's not to say it's useless. Did you know you can chomp an array?
In that snippet, $result is set to 3 and all elements of the array have had their trailing newline removed. Offhand, I don't see the utility of chomp returning the number of elements chomped, but I also remember that when I first started programming, I didn't see the utility of the ternary operator ( y = x ? y : x ). Now, I use it all the time. chomp itself is very useful when I pull in data from a variety of sources and do something with them. I usually don't want a bunch of newlines unless I put them there.
Cheers, Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In Section
Seekers of Perl Wisdom
|
|