#!/usr/bin/perl my %tests=( -s => "size > 0", -T => "type Text", -B => "is Binary", -r => "is readable", -z => "is Zero bytes", ); my $myfile=$0; foreach my $t (keys %tests) { if ( eval("$tests{$t} $myfile") ) { print "Passed [$t] test ($tests{$t})\n"; } else { print "Failed [$t] test ($tests{$t})\n"; } } Thanks