John W. Krahn wrote:


I don't think you understand how chomp() works:

perldoc -f chomp
   chomp VARIABLE

   chomp LIST

   chomp   This safer version of the chop entry elsewhere in
           this document removes any trailing string that
           corresponds to the current value of `$/' (also
           known as $INPUT_RECORD_SEPARATOR in the `English'
           module).  It returns the total number of
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           characters removed from all its arguments.
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I've always thought that behaviour kinda weird myself (though now it's become second nature). I like the way Ruby has two versions for chop/chomp:


newstring = str.chomp; # leave original untouched
str.chomp!;            # update original inplace

Of course, method names with punctuation take a little getting used to.

Randy.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to