Hi - I'd like to do this sort of thing but the eval test fails...
#!/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
In reply to File testing via list of test operators by robh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |