The sort() function returns a list in sorted order @foo = ( "b", "d", "a", "c" ); @foo = sort( @foo ); # @foo is now ( "a", "b", "c", "d" )