use warnings; use strict; checkDir('/usr/tmp', '-w'); #or... checkDir('/usr/tmp', '-r'); sub checkDir { my ($dir, $perm) = @_; print "Dir: $dir, Perm: $perm\n"; }