use strict; use warnings; my $filename = "c:\\myfile.txt"; checkit ("-e,-w", $filename) ? print "File $filename exists and is writeable" : print "File $filename does not exist or is not writeable"; sub checkit { my ($tests, $filename) = @_; my @testList = split ",", $tests; for (@testList) { return 0 if ! eval ("$_ '$filename'"); } return 1; }