Perlfunc: get_file_perm()

Quick function to get the permissions of a file with Perl.

sub get_file_perm {
    my $file = shift();

    # Permissions are the second element of stat
    my $mode = (stat($file))[2];
    my $perm = sprintf("%04o",$mode & 07777);

    return $perm;

Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
Logged IP:
To prevent spam please submit by clicking the kitten: