Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Moving data in a tree

by wade (Pilgrim)
on Jul 21, 2008 at 20:56 UTC ( [id://699149]=note: print w/replies, xml ) Need Help??


in reply to Re: Moving data in a tree
in thread Moving data in a tree

Interesting. I'd have done this a little differently. When you are traversing the tree and you are done processing a node, check to see if it only has one leaf. If so, move the single leaf to its parent node (deleting children that have no leaves). The end result would be the same (i.e., branches with single leaves would get moved to the root) but this would allow nodes that wouldn't make it all the way to the root to be propagated as high as they could be.

Of course, that's not what the OP actually requested so I could be full of...er, um...I could be wrong.

--
Wade

Replies are listed 'Best First'.
Re^3: Moving data in a tree
by hoffmann (Novice) on Jul 21, 2008 at 21:10 UTC
    Would it be possible to load the excel file as is, then run the perl script on it?

      In general, if I don't have a memory crisis, I'd:

      • read the whole file into a suitable data structure,
      • manipulate the data structure, and
      • write the data structure out to a new file.

      That makes things easier to code and, since you have before and after files, easier to check.

      --
      Wade

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://699149]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-24 04:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found