Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: reparse tree in textfile

by repellent (Priest)
on Feb 20, 2010 at 07:02 UTC ( [id://824324]=note: print w/replies, xml ) Need Help??


in reply to Re^2: reparse tree in textfile
in thread reparse tree in textfile

    Why set the length of the array only to change it immediately?

It was one way to do it. The goal was to keep @path with only "pure" node information, and not have redundancies like ".", "/", and previous nodes repeated as the indexes go higher.

    I also hate the needless use of global vars.

Me too. But a data structure outside the loop was needed to oversee things.

Replies are listed 'Best First'.
Re^4: reparse tree in textfile
by ikegami (Patriarch) on Feb 20, 2010 at 07:12 UTC

    It was one way to do it. The goal was to keep @path with only "pure" node information

    That's unrelated. I was referring to $#a=...; push @a,...;. The first statement sets the size of the array. Then next changes it. Why not just set it to the right size right from the start.

    Me too. But a data structure outside the loop was needed to oversee things.

    eh? What global data structure? I was referring $1 and $2. The only other global is DATA.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-25 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found