in reply to Re: array sorting
in thread array sorting
@sorted = sort @unsorted; $string = join " ", @sorted; print $string;
That's the same as....
print join( " ", sort @unsorted );
Except that you're not using two intermediate variables. sort takes a list or array as input, and spits out a sorted list which you can either slurp into an array, or send into the input side of join. join takes a list or array as input, and joins its elements together with whatever you put between the quotes, to create a single big-old string. print takes a list (even if the list is one element... and in this case the one element is the string which is the output of join).
Hope this helps...
Dave
|
|---|