use cwd my $dir = cwd() foreach my $files (global("$dir/*.txt")) {