in reply to 'ls' with octal permissions
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 'ls' with octal permissions
by oko1 (Deacon) on Mar 27, 2011 at 14:35 UTC |