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]"; }
In reply to Re: How to remove a carriage return (\r\n)
by pg
in thread How to remove a carriage return (\r\n)
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |