Click here to get back home

$str1 eq $str2 causing problems

 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
$str1 eq $str2 causing problems Ashish Gupta 08-22-2005
Posted by Ashish Gupta on August 22, 2005, 12:11 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 Ashish Gupta on August 22, 2005, 2:00 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
`our' declaration causing problems with `strict' pragma across files July 21, 2004, 6:26 am
quote causing DBD::CSV failure February 28, 2006, 6:42 pm
cgi script causing perl loop???? May 25, 2007, 4:27 pm
Returned mail is causing script to crash August 12, 2004, 11:40 am
Char like "á" causing the data parse to fail... July 24, 2005, 9:44 pm
CGI-Timeout causing "internal server error"???? July 20, 2006, 4:58 pm
Identification of which line causing regex problem May 5, 2008, 9:44 pm
LWP problems July 11, 2005, 8:04 pm
LWP-problems December 13, 2005, 2:14 am
help me problems cgi January 14, 2007, 9:42 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap