my %d = map {split//} qw/sx S- r4 w2 x1 -0/; #### my %d = qw/s x S - r 4 w 2 x 1 - 0/; #### for my $file ( @ARGV ) { my $mode = ( stat $file )[ 2 ]; my $ls = `/bin/ls -l $file`; $ls =~ s/^(.)([rwxsStT-]+)(?=\s)/[$1] @{[ sprintf '%04o ', $mode & 07777 ]}/; print $ls; }