use SuperSplit; if ( $^O =~ /linux/){ $dir = `ls -l`; $col = 4; }else{ #sorry, no macs ;-) $dir = `dir -w`; $col = 2; } @$sortedref = sort{ $a->[$col] <=> $b->[$col] } @{supersplit('\s+','\n',$dir)}; print superjoin( $sortedref );