Click here to get back home

qr// doesn't handle m modifier?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
qr// doesn't handle m modifier? adam 09-01-2006
Get Chitika Premium
Posted by xhoster on September 4, 2006, 7:05 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Posted by anno4000 on September 5, 2006, 5:55 am
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Similar ThreadsPosted
Prematch ($`) and the m//g modifier March 9, 2006, 8:09 pm
Why doesn't it evaluate in RE using "e" modifier ?? January 2, 2008, 5:50 am
s replace p modifier April 14, 2008, 7:13 pm
/e modifier to s///; short "1 liner" ? December 7, 2007, 1:26 pm
can LWP handle this? October 21, 2008, 7:56 am
GLOB vs IO::Handle January 11, 2005, 1:49 pm
handle to /dev/null? September 20, 2005, 3:58 pm
How to handle large variable October 28, 2004, 8:50 pm
FAQ 4.46: How do I handle linked lists? October 28, 2004, 11:03 pm
file handle problem December 4, 2004, 7:29 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap