Click here to get back home

puting an excel file into a perl data structure

 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
puting an excel file into a perl data structure KaZ 06-28-2006
Get Chitika Premium
Posted by KaZ on June 28, 2006, 12:16 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 Peter J. Holzer on June 29, 2006, 9:42 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

Similar ThreadsPosted
Extract data from an Excel file January 13, 2006, 1:36 am
What is the best way to make a Tree Data Structure in one text file? August 19, 2004, 6:49 pm
perl - data structure build to transpose data August 28, 2004, 9:34 pm
adding an excel worksheet to a generetad excel file via perl April 17, 2007, 8:38 am
perl data structure February 19, 2008, 12:15 pm
eval of Data::Dumper output not same as original data structure August 1, 2007, 3:05 am
Perl Complex Data Structure Parsing December 3, 2006, 1:56 pm
Perl data structure to hold same multiple keys and different values September 17, 2007, 6:38 am
data structure December 8, 2004, 12:09 pm
data structure problem January 27, 2006, 3:39 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap