Click here to get back home

modifying hash key (dispatch table)

 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
modifying hash key (dispatch table) Jeff Thies 10-28-2004
Get Chitika Premium
Posted by Jeff Thies on October 28, 2004, 8: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

Posted by Paul Lalli on October 28, 2004, 8: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
post into hash table November 26, 2004, 3:53 pm
maximum size of a hash table February 23, 2005, 8:30 pm
Printing hash in table format June 19, 2006, 1:01 am
Sort Keys in hash table? August 16, 2006, 6:49 pm
How to parse text file into hash table April 24, 2007, 1:30 pm
Help with understanding/using dispatch tables April 12, 2007, 2:04 pm
Custom message formatting callback for Log::Dispatch July 11, 2005, 1:24 am
? about using multi-level menu system using dispatch method April 9, 2008, 12:25 pm
Formatting a single line without effecting the entire table with the Text::Table module March 10, 2005, 11:18 am
modifying @ISA August 6, 2004, 4: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