sub sortArray { my ($ar) = @_; @$ar = sort @$ar; } my @a = qw( e d c b a ); sortArray(\@a); print("@a\n"); # a b c d e