sub getClients{ my @tuples = map [split ' ', $_] grep { !/^(?:#|$)/ } @file; foreach(sort {$a->[1] cmp $b->[1]} @tuples){ my ($cltnbr, $cltname) = @$_; print "$cltname"; } }