www.perl.com
Perl Programming
File Checks
  • File checks
    • File test operators check if a file exists, is readable or writable, etc.
    • -e tests if file is exists
    • -r tests if file is readable
    • -w tests if file is writable
    • -x tests if file is executable
    • -l tests if file is a symlink
    • -T tests if file is a text file
    • perldoc perlfunc lists more

        my $filename = "pie_recipe";
        if (-r $filename) {
            open INPUT, "> $filename" or die "Can't open $filename: $!";
        } else {
            print "The file $filename is not readable.\n";
        }
      
Previous http://stuff.mit.edu/iap/perl/