use strict; my @files = qw/foo bar/; foreach my $file (@files) { if (-e "$file") { print $file, " found\n"; } else { print $file, " not found\n"; } }