in reply to Where to declare?

Not the specific answer to your problem, but do you really need a nested sub for this application? A while loop is much much easier to build around than this. KISS. eg:
my @dirlist; print qq(Enter a valid directory); chomp (my $ans = <STDIN>); while ( $ans ne "" ) { if ( $ans =~ m/foo/g ) { push @dirlist, $ans; } else { print qq(That is not a valid dir); } print qq(Enter a valid directory); chomp ($ans = <STDIN>); } # @dirlist is now filled happily

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important

Replies are listed 'Best First'.
Re: Re: Where to declare?
by traveler (Parson) on Oct 24, 2001 at 23:11 UTC
    As an aside to your suggestion, I remember a programming course that taught recursion before loops and then taught while loops as an alternative to the "more natural" tail recursion. Interesting what some consider "simple".

    --traveler