# all html files in one directory my @files = glob 'path/to/dir/*.html'; #### # all html files in all (direct, slibling) subdirectoris in a directory my @files = glob 'path/to/dir/*/*.html'; #### use File::Spec::Functions qw(rel2abs abs2rel); my $txt = rel2abs(abs2rel($file, $htmlroot), $txtroot); # relocate $txt =~ s/\.html$/.txt/; # extension