in reply to Re: check if file is executable by user/group/world?
in thread check if file is executable by user/group/world?

Just a quick clarification on the source of $mode in the ree's example above
perl -e 'use Fcntl qw(:mode);$permissions=S_IMODE((stat("filename"))[2 +]);print $permissions,"\n";'

Replies are listed 'Best First'.
Re^3: check if file is executable by user/group/world?
by vinoth.ree (Monsignor) on Aug 06, 2009 at 08:50 UTC

    Sorry!Utilitarian I just given the hint, and missed something,Below the code I just tried,

    use Data::Dumper; use Fcntl ':mode'; my $filename="pl_bak.pl"; my @array=lstat($filename); $permissions = sprintf "%04o", S_IMODE($array[2]); print "File permissions: $permissions\n";
    Update

    Removed a file type line.