more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: 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 reply to (Ovid) Re: How do you chomp your chomps?
by Ovid
|
|