in reply to How to remove a carriage return (\r\n)
To be a little bit cross-platform, just do:
use strict; use warnings; { my $str = "abcd\r\n"; $str =~ s/\r|\n//g; print "[$str]"; } { my $str = "abcd\n"; $str =~ s/\r|\n//g; print "[$str]"; } { my $str = "abcd\r"; $str =~ s/\r|\n//g; print "[$str]"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to remove a carriage return (\r\n)
by jgallagher (Pilgrim) on Nov 01, 2005 at 18:44 UTC | |
by 3dbc (Monk) on Nov 13, 2012 at 16:13 UTC |