Click here to get back home

pack problem?

 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
pack problem? Davy 08-27-2006
Posted by Davy on August 27, 2006, 11:17 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 DJ Stunks on August 27, 2006, 11:29 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
"RFC": re [un]pack() September 10, 2004, 12:15 am
pack 'C3U*' not same as pack 'C3(xC)*' June 23, 2005, 7:48 am
Need help with pack October 1, 2005, 11:00 pm
pack and hex October 3, 2008, 6:16 am
Trying to force 32-bit in pack() October 12, 2004, 5:19 pm
pack and unpack ? January 9, 2005, 11:37 am
sprintf or pack January 30, 2007, 7:33 am
pack /unpack issue November 10, 2005, 7:48 pm
pack, unpack and 64-bit values February 9, 2006, 12:55 pm
extracst the first 8 bits with pack August 22, 2006, 4:08 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap