my %d = map {split//} qw/sx S- r4 w2 x1 -0/;
Really??? Why not just:
my %d = qw/s x S - r 4 w 2 x 1 - 0/;
Or you could just do the whole thing like this:
for my $file ( @ARGV ) { my $mode = ( stat $file )[ 2 ]; my $ls = `/bin/ls -l $file`; $ls =~ s/^(.)([rwxsStT-]+)(?=\s)/[$1] @{[ sprintf '%04o ', $mo +de & 07777 ]}/; print $ls; }
In reply to Re: 'ls' with octal permissions
by jwkrahn
in thread 'ls' with octal permissions
by oko1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |