in reply to Skipping files in a directory

You can also use the warn to print the warnings

my @DIRS=qw(there notthere there); foreach (@DIRS) { if (-d $_) { # Do the task. } else { warn "File not found\n"; } }