Click here to get back home

Re: stuck in a control loop

 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
Re: stuck in a control loop Keith Keller 10-24-2007
Posted by Keith Keller on October 24, 2007, 3:05 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 merl the perl on October 30, 2007, 11:52 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
stuck in a while loop June 29, 2006, 10:59 pm
Problem with loop control LAST exiting prematurely March 18, 2008, 6:22 am
What does "exit the block or routine with a loop control operator" mean? July 24, 2004, 4:17 am
Net::SSH stuck October 12, 2006, 1:43 am
Apache/mod_perl server getting stuck February 6, 2007, 4:38 pm
Any Help? Stuck trying to create cgi perl program April 18, 2007, 3:02 pm
Stuck trying to pass an array that contains a hash to another subprogram March 21, 2007, 6:54 pm
process control September 28, 2004, 12:12 am
How to control version of OS September 27, 2005, 1:52 pm
How to control PDF printer July 29, 2006, 8:11 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap