... @temp = sort map { ( split )[ 2 ]; } `ls -l /directory/pth/here`; foreach( @temp ) { $authors{$_}=1 if not $authors{$_} and length $_; } ...