In article <Lt*********************@twister.southeast.rr.com> ,
Schroeder <jf*******@nc.rr.com> wrote:
I am using ActiveState's Perl on Windows and am trying to remove an excess
\x0d character I am getting (not sure why I am getting it, but doesn't
matter if I can easily be rid of it). What I see in my text is sequences of
\x0d\x0d\x0a - and I am trying to replace them with simply CRLF (\x0d\x0a).
I admit to being a newbie to Perl, so maybe I am just missing something.
Why wont the following work:
$text =~ s/\x0d\x0d\x0a/\x0d\x0a/gs;
It works for me:
#!/usr/local/bin/perl
#
use strict;
use warnings;
my $text = "abc\x0d\x0d\x0adef";
p("Before",$text);
$text =~ s/\x0d\x0d\x0a/\x0d\x0a/gs;
p('After',$text);
sub p
{
my($title,$text) = @_;
print "\n$title:\ntext=<$text>\n";
print join(' ',map { ord $_ } split(//,$text)),"\n";
}
__OUTPUT__
Before:
text=<abc
def>
97 98 99 13 13 10 100 101 102
After:
text=<abc
def>
97 98 99 13 10 100 101 102
You need to post a short program demonstrating the problem you are
having.
FYI; this newsgroup is defunct. Try comp.lang.perl.misc in the future.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---