Click here to get back home

What is the best way to make a Tree Data Structure in one text file?

 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
What is the best way to make a Tree Data Structure in one text file? http://links.i6networks.com 08-19-2004
Posted by http://links.i6networks.com on August 19, 2004, 6:49 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 August 19, 2004, 7:44 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
change tree structure file to rank-order file December 2, 2005, 9:23 am
display in a tree structure March 26, 2008, 7:07 am
puting an excel file into a perl data structure June 28, 2006, 12:16 pm
An efficient way to make a large directory tree? December 3, 2004, 5:11 pm
eval of Data::Dumper output not same as original data structure August 1, 2007, 3:05 am
Parse tree like data like XML by Perl? October 8, 2006, 10:08 pm
deleting data from a text file October 11, 2004, 11:28 am
perl - data structure build to transpose data August 28, 2004, 9:34 pm
Modify program to write just data to a text file. October 27, 2004, 3:35 am
problem searching and replacing text file data April 23, 2006, 10:05 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap