use strict; use warnings; use File::Spec; dir('.'); sub dir { my $p = shift; if(my $dir = opendir $p)) { while(my $f = readdir $dir)) { next if $f =~ /^\.?\./; my $path = File::Spec->catfile( $p, $f ); print "$path\n"; dir($path) if -d $path; } closedir $dir; } }