foreach (sort @$outputRef) { print $_, "\n"; } #### @sorted = sort @$outputRef;