On Jun 14, Randy W. Sims said:

>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.

In Perl, these are spelled:

  chomp($newstring = $str);
  chomp($str);

In Perl 6, chomp() will probably be a string method, which means you might
be able to write

  ($newstring = $str).chomp;

But this is speculation.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
CPAN ID: PINYAN    [Need a programmer?  If you like my work, let me know.]
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.


-- 
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