sub listfiles { my $path = shift || '.'; opendir ( DIR, $path ) or die "Can't open path: $!\n"; return grep { -f "$path/$_" } readdir ( DIR ); }