http://www.perlmonks.org?node_id=33958

Q&A > files > How do I get all the permission flags on a file? - Answer contributed by BastardOperator

If merlyn's answer confuses you at all, try this:
sub return_mode { my $mode = shift; my @modelist = (($mode & 7000)>>9, ($mode & 0700)>>6, ($mode & 007 +0)>>3, ($mode &0007)); return join('', @modelist); }
Also, I don't know if you would be concerned with ACL's at all, I'm not sure how you would handle those if you were, just wanted to give you a heads up depending on how detailed you're being.