[tpm] chomp problem
Mark Fowle
mfowle at navicominc.com
Fri Feb 4 12:56:48 PST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20110204/d270c040/attachment.html>
More information about the toronto-pm
mailing list