[tpm] chomp problem
Tom Legrady
legrady at gmail.com
Fri Feb 4 16:55:30 PST 2011
Perl should know what platform you are on, and whether \n is carriage
return, linefeed, or both. Looks to me like something about your
configuration or locale is confusing Perl.
On Fri, Feb 4, 2011 at 3:56 PM, Mark Fowle <mfowle at navicominc.com> wrote:
> line ends in windows tend to be \r\n.
> comp safely removes one line end character, as aposed to chop that removed
> one cjharacter from the end of a line.
> so chomp$_; chomp $_; is safe and will work on any computer OS.
>
>
>
> ________________________________
> From: toronto-pm-bounces+mfowle=navicominc.com at pm.org
> [mailto:toronto-pm-bounces+mfowle=navicominc.com at pm.org] On Behalf Of Omid
> Gulban
> Sent: Friday, February 04, 2011 3:42 PM
> To: tpm at to.pm.org
> Subject: [tpm] chomp problem
>
> Hello All,
>
> I have a simple script shown below:
> on windows xp platform.
>
>
>
> use warnings;
> use strict;
>
> while (<DATA>) {
> chomp $_;
> print "$_";
> }
>
> __END__
> a
> b
> c
> d
> e
> f
> g
> h
>
>
> Why do I get an output that looks like this:
> a
> ab
> bc
> cd
> de
> ef
> fg
> ghh
>
> I expected to see:
> abcdefg
>
>
> Thanks
> O
>
>
> _______________________________________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/listinfo/toronto-pm
>
>
More information about the toronto-pm
mailing list