in reply to Its not supposed to!

I'm not sure exactly what you're doing w/ this code, but you might investigate using File::Find, since it does a similar thing.
use File::Find; my @dirs; sub wanted { push @dirs, $File::Find::name if -d $_; } find(\&wanted, 'foo');

Replies are listed 'Best First'.
RE: Re: Its not supposed to!
by BBQ (Curate) on Apr 18, 2000 at 05:09 UTC
    While there ARE modules out there that will do this, its such a small snip of code I didn't want to bother logging onto CPAN and looking for something that would do the job for me.

    Appart from the fact that the name Find::File::etc doesn't suggest what I was trying to do...

    The result of this snippet is now being used on my cron to pickup the directories in my /tmp and delete *.htm, *.txt, *.pdf, and files of the sort.

    Last time I checked, my /tmp had like 250 megs of sh1t I wasn't using. This keeps me tracking the stuff I really need.

    But thanks anyway!
      I understand. No problem with writing your own code.

      Although File::Find (not Find::File) is actually in the core distribution, so you wouldn't have to go to CPAN to get it.

        No wonder it didn't load! :o)

        But being strictly picky (for this size of operation at least), isn't it cheaper (disk/cpu wise) to do my own small recursion?