#!/usr/bin/perl -w use strict; sub checkit { my $file = shift; return (-e $file && -w _); # the _ is a shortcut for checking on the same file instead of making another stat call } my $ret = checkit("/home/monk/hello"); if ($ret) { print "File exists with write perm\n" } else { print "File does not exist or no write perm\n"; }