Click here to get back home

print thought given reference to a hash

 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
print thought given reference to a hash Dan Jacobson 05-19-2006
Get Chitika Premium
Posted by Dan Jacobson on May 19, 2006, 5:37 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 John Bokma on May 19, 2006, 7:26 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
print statement creates key in hash with reference to empty array?? January 31, 2006, 11:24 am
Problem using print with a reference to a filehandle June 1, 2006, 10:10 am
copying values from a hash into CGI.pm via tied hash reference December 27, 2004, 7:02 am
Combining multiple hash references into one hash reference September 1, 2005, 1:47 pm
Hash slice from a hash reference? September 9, 2006, 12:38 pm
I just thought I'd ask... August 21, 2005, 7:16 am
Found this and thought if was of Use ! December 16, 2004, 7:23 am
I sat, thought about this, and I still don't understand it. November 3, 2006, 8:45 am
Idle thought about bless June 13, 2008, 10:48 pm
FAQ 4.69 How can I use a reference as a hash key? February 12, 2005, 6:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap