Equivalent of Perl chomp?
Steve Holden
sholden at holdenweb.com
Fri Feb 1 13:14:47 EST 2002
"Paul Watson" <pwatson at mail.com> wrote ...
> Perl chomp only removes -all- traliing newlines when in paragraph mode.
> Paragraph mode is when $/ is set to "". The default mode is not paragraph
> mode, so chomp removes only one (1) newline.
>
> === code
> $s = "now\n\n\n";
> print "length($s) = ".length($s)."\n";
> chomp($s);
> print "length($s) = ".length($s)."\n";
>
> === output
> length(now
>
>
> ) = 6
> length(now
>
> ) = 5
>
Maybe we shoud ask the guys on c.l.perl about this [ducks and runs]
regards
Steve
--
Consulting, training, speaking: http://www.holdenweb.com/
Python Web Programming: http://pydish.holdenweb.com/pwp/
More information about the Python-list
mailing list