[Pdx-pm] recursive IO::Dir

Andy Lester andy at petdance.com
Thu Feb 18 11:09:01 PST 2010


On Feb 18, 2010, at 1:04 PM, Tom Keller wrote:

> I need to be able to process files within a directory tree. I know  
> there is a module IO::Dir::Recursive, but I have trouble wrapping my  
> brain around recursion, so I wanted to give it a try just using  
> IO::Dir. This seems to do the recursion correctly:
>


I'd like to suggest File::Next.

# This is from memory
use File::Next;
my $files = File::Next::files( $directory );
while ( defined my $file = $files->next ) {
     process_file( $file );
}

Butt simple, eh?

xoxo,
Andy

--
Andy Lester => andy at petdance.com => www.theworkinggeek.com => AIM:petdance






More information about the Pdx-pm-list mailing list