Click here to get back home

Problem with binary numbers

 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
Problem with binary numbers perldude 02-06-2005
Posted by perldude on February 6, 2005, 3:59 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 Anno Siegel on February 6, 2005, 5:33 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
join two binary numbers May 22, 2006, 7:31 am
want to join two binary numbers May 22, 2006, 8:39 am
How to add two binary numbers using bitwise AND November 15, 2007, 6:45 pm
Problem with Reading a Binary File December 7, 2005, 3:51 pm
Help: Binary June 27, 2007, 10:39 am
hex to binary March 18, 2008, 7:37 am
hex to binary conversion November 29, 2004, 4:00 pm
Binary compatibility 5.8.0 -> 5.8.7 June 8, 2005, 6:40 pm
Net::FTP - Binary mode November 13, 2005, 2:42 pm
Binary to Decimal for >2**32 November 14, 2007, 3:45 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap