On 10/20/2006 05:35 AM, Xavier Noria wrote:
On Oct 20, 2006, at 11:54 AM, Chris Share wrote:
In the output of the following code there's a carriage return between
the $name variable and the "!". Where is this coming from? Doesn't the
chomp get rid of this?
[...]
Looks like CGI.pm puts STDIN in binmode on Windows:
$needs_binmode = $OS=~/^(WINDOWS|DOS|OS2|MSWin|CYGWIN)/;
# ...
if ($needs_binmode) {
$CGI::DefaultClass->binmode(\*main::STDOUT);
$CGI::DefaultClass->binmode(\*main::STDIN);
$CGI::DefaultClass->binmode(\*main::STDERR);
}
If that is correct the CRLF -> LF translation of the I/O layer is
disabled and chomp does not remove CR (because $/ is "\n" by default).
Once you see why it is working that way I guess you can change your code
accordingly.
-- fxn
IOW, Chris would set $/ to "\r\n" before performing the chomp.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>