Click here to get back home

[BEGINNER] Regex with ~

 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
[BEGINNER] Regex with ~ soup_or_power 04-01-2005
Posted by soup_or_power on April 1, 2005, 8:04 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

Posted by Gunnar Hjalmarsson on April 1, 2005, 6:28 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

Similar ThreadsPosted
Beginner: regex-error? August 1, 2006, 4:42 pm
[BEGINNER} Question April 4, 2005, 8:01 am
Beginner Question #1 April 12, 2005, 6:27 am
Beginner DBI problem October 18, 2005, 7:06 pm
use of uninitialized value (beginner) June 21, 2006, 1:12 am
Beginner: match /$key/ August 3, 2006, 12:56 am
A Perl Beginner March 19, 2007, 10:39 am
Learning PERL for a new beginner February 4, 2005, 1:18 am
forms, cgi - beginner question February 15, 2005, 10:39 am
[BEGINNER] Embperl question April 6, 2005, 1:00 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap