Click here to get back home

Multi-dim hash slices

 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
Multi-dim hash slices Dinko Korunic 01-17-2005
Posted by Dinko Korunic on January 17, 2005, 9:54 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 Gunnar Hjalmarsson on January 17, 2005, 12: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

Similar ThreadsPosted
Hash slices October 25, 2004, 9:36 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
Searching an example for a defined hash value of a nonexisting hash key July 20, 2004, 5:47 pm
Perh Hash of Hash of Array structure March 29, 2007, 2:52 pm
how access to hash which contains hash and sclar var? December 12, 2004, 12:09 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap