Do you know where your variables are? | |
PerlMonks |
Infinite loop yet no loopby ido50 (Scribe) |
on Mar 18, 2004 at 18:52 UTC ( [id://337763]=perlquestion: print w/replies, xml ) | Need Help?? |
ido50 has asked for the wisdom of the Perl Monks concerning the following question:
Hi again! Okay so I'm writing a CGI/Perl program (Object-Oriented Style) for some purpose. I use a tree-like structure in my program which, at certain situations, loads information from a database. Foreach database entry, the program adds it to the tree, but only if its parent was already found (and added). If not, it pushes it into a buffer array. In the end of the database reading, another method iterates over the buffer and adds the entries in it to the tree. Once again, this method also adds only if the parent was already added. So if an item from the buffer is added to the tree, it is also deleted from the buffer, and the method runs recursively with the changed buffer. When calling the method, the program enters an infinite loop. I thought the recursion was the cause of it, so I deleted it to verify it, and it wasn't. It did the same thing again. Anyway, the code looks like this (Recursion call commented out: That's it. For some reason, the program enters an infinite loop, and I have no idea why. Any help grately appreciated, Ido Perelmutter. ------------------------- Live fat, die young
Back to
Seekers of Perl Wisdom
|
|