in reply to Its not supposed to!

I was also puzzled by this till I realized that, for any empty case (either an empty dir or one without subdirs), the "recursive" call isnt going to return (); its going to return whatever its already in @dirs

So, in fact this "recursive" function is using @dirs as an stack. But in any case I dont think this is a good way to solve the problem, cause it really depends on something that is not evident at first sight, and it goes against the intuitive definition of your function; that is, you would expect it to return the subdirs of a dir you pass to it, not that and whatever you already have in @dirs.

Replies are listed 'Best First'.
RE: RE: Its not supposed to!
by BBQ (Curate) on Apr 18, 2000 at 05:04 UTC
    I agree! While obfuscation is fun, I try to be as readable as possible. I'm commenting that in the code right now.

    Thanx!