http://qs1969.pair.com?node_id=135530


in reply to chop() and chomp()

perlfunc Describes both chop and chomp, with good examples and excellent detailed explanations.
I downvoted the tutorial, because it adds nothing to the existing documentation and thus only makes things harder for beginners.

  1. Why did you use $a instead of $_?
  2. print Doesn't return it's given attributes, it returns true if succesful. All your "would return" comments are wrong.
  3. You didn't even chomp arrays or hashes.

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Replies are listed 'Best First'.
Re: Re: chop() and chomp()
by Parham (Friar) on Jan 03, 2002 at 05:51 UTC
    it wasn't meant as a horribly detailed tutorial. It was meant as a VERY simple tutorial for those that might have not understood why the functions were used. I had it on the computer and i decided to add it to the 'tutorials' section cuz there were no other tutorials on the subject. I didn't use $_ because it might have very well confused those starting out. When in my comment i used 'return', i did not mean literally, i just meant it would 'output' and i feel the need to chomp arrays or hashes cuz again, i wanted it to be a very simple tutorial. I very well understand why you downvoted the tutorial and hope the explanation i gave helped you understand why i wrote it very basically :).
Re^2: chop() and chomp()
by Anonymous Monk on Mar 15, 2006 at 02:50 UTC
    I'm new to perlmonks (and somewhat to perl) and I hope this acidic comment is an isolated case concerning reactions to people who post useful tutorial tidbits. I for one understood the original post very well. Granted, I think that total newbies might be a bit confused by "print" returning a string. Still, don't you think it's better providing a clarification in a less ...overbearing... tone? :)