use strict; use warnings; use Path::Class::Rule; my $rule = Path::Class::Rule->new; # match anything $rule->file->name('*.txt'); my $next = $rule->iter( @dirs ); while ( my $file = $next->() ) { ReadThat( $file ); }