Click here to get back home

Searching an example for a defined hash value of a nonexisting hash key

 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
Searching an example for a defined hash value of a nonexisting hash key Ralf Baerwaldt 07-20-2004
Get Chitika Premium
Posted by Ralf Baerwaldt on July 20, 2004, 5:47 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 Paul Lalli on July 20, 2004, 12:05 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
Problem using defined constants as hash keys April 15, 2005, 6:05 am
Searching within the hash values of an array of hashes August 26, 2007, 12:18 am
Hash ref problem in Plucene::Simple (while searching a term) November 6, 2004, 10:27 pm
Perl hash and rehash seeds; deterministic hash ordering January 19, 2007, 5:01 pm
copying values from a hash into CGI.pm via tied hash reference December 27, 2004, 7:02 am
Module for getting values from "flattened" hash or "recursed" hash...? March 8, 2005, 7:05 pm
Combining multiple hash references into one hash reference September 1, 2005, 1:47 pm
Adding values to anon hash of hash while looping... September 2, 2005, 7:42 am
Sort by hash vaule, an array of hash references October 6, 2005, 12:52 pm
Perh Hash of Hash of Array structure March 29, 2007, 2:52 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap