[Canberra-pm] Recursion in Perl

Kim Holburn kim at holburn.net
Wed May 24 18:24:34 PDT 2006


Can't you slurp the file into an array or hash once then refer to it  
in each recursion?

This would surely be better than reading it over and over.

On 2006 May 25, at 10:53 AM, Andrew Pollock wrote:

> My turn to ask a question.
>
> (Disclaimer: recursion does my head in at the best of times)
>
> I'm trying to walk through a bunch a config files to build up a data
> structure that represents the inclusion relationships between them.
>
> So at the moment, as I prototype this, I've got a subroutine that  
> will call
> itself again on a file if it hasn't already seen it, and see what  
> includes
> it mentions, and then call itself again on them.
>
> What I seem to be encountering is a bunch of "readline() on closed
> filehandle" errors, so I'm wondering if the filehandle namespace isn't
> unique to each call of the subroutine, and I'm closing it in a  
> subsequent
> invokation, or I've caused my brain to explode in another more subtle
> manner.
>
> regards
>
> Andrew
> _______________________________________________
> Canberra-pm mailing list
> Canberra-pm at pm.org
> http://mail.pm.org/mailman/listinfo/canberra-pm
>



--
Kim Holburn
Network Consultant
Ph: +61 2 61258620 M: +61 417820641  F: +61 2 6230 6121
mailto:kim at holburn.net  aim://kimholburn
skype://kholburn - PGP Public Key on request
Cacert Root Cert: http://www.cacert.org/cacert.crt
Aust. Spam Act: To stop receiving mail from me: reply and let me know.

Use ISO 8601 dates [YYYY-MM-DD] http://www.saqqara.demon.co.uk/ 
datefmt.htm
Democracy imposed from without is the severest form of tyranny.
                           -- Lloyd Biggle, Jr. Analog, Apr 1961




More information about the Canberra-pm mailing list