On Thu, 17 Nov 2005 10:10:17 +0800, The Ghost <[EMAIL PROTECTED]> wrote:
I have some code that chomps a variable, but the variable still seems to
have a newline. But if I chop it I am rid of the newline. What's going
on with that string?
Perhaps that newline is Windows specific (like \r).
To view the hidden string you can use this
command: cat -A filename.txt
Then in Perl you can remove them using regex:
sub remove_trailing_newline {
$_[0] =~ s/[\r\n]+\Z//;
}
Hope that helps.
--
Regards,
Edward WIJAYA
SINGAPORE
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>