Click here to get back home

using nested foreach loops

 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
using nested foreach loops Kirk Russell 08-06-2004
Get Chitika Premium
Posted by Kirk Russell on August 6, 2004, 6:06 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 Paul Beckingham on August 6, 2004, 3:00 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
Arbitrarily Many Nested Loops March 29, 2006, 7:51 pm
foreach loops and lexically scoped loop variables May 26, 2006, 5:45 pm
[perl-python] 20050211 generating expression by nested loops February 11, 2005, 4:02 pm
nested foreach loop November 14, 2008, 7:43 pm
Loops with loops using html-template January 12, 2006, 2:25 pm
what the difference between these loops? November 16, 2006, 6:23 pm
Perl loops should use break, not last January 29, 2005, 4:42 pm
Question on loops and return values December 3, 2004, 3:02 pm
autosave everytime loops runs August 11, 2006, 2:45 pm
efficient way to write multiple loops code October 7, 2008, 4:31 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap