in reply to Re: Its not supposed to!
in thread Its not supposed to!

I *think* I get it...

What you're saying is that I could as well do this
foreach $leaf (glob("$startdir/*")) { if (-d $leaf) { $trash = GetDirs($leaf); push(@dirs,$leaf); } }
because it would still recurse, and it really doesn't matter what I'm assigning the return of the recursion (like $trash) because I'm pushing every $leaf to @dirs right after anyway? What really matters is the return of the 1st call and not the $trash.

Or was that totally off track?

BTW: You're explanations are always fun to read... Thanx!

Replies are listed 'Best First'.
RE: RE: Re: Its not supposed to!
by chromatic (Archbishop) on Apr 18, 2000 at 06:19 UTC
    You don't even need the assignment to $trash in there, as the function might as well be declared void (in C or C++, if you're familiar). What you're concerned about is the side-effect of the subroutine.

    I tried to come up with a better way to do that, without the global variable, but I think you've hit on the clearest method with that recursion.

    (BTW, there is an account for isotope on this machine, though not under that nickname. Thanks for the kind words.)