Perl Arrays and Substituion

@xray =~ s/^ *//g;
@xray =~ s/ *$//g;
@xray =~ s/\s+/ /g;

Guess I have a two part question ...
First
Is there a way to make substitutions, remove leading spaces, trailing spaces, and crunch multiple spaces into a single space, to the entire array, or must the substitutions be done on on each element looping through the array ?

Second
How can I do all 3 substitutions at once. If using ksh, I'd sed -e
for instance.

Sorry ... left my flash drive with the OReilly perl bookshelf on it at
home !!!

For (1), that can be done without an explicit loop, using a map {} block. However, that is essentially a loop in disguise because map executes a block on every item in the array.

For (2), that is not supported as far as I know. If you find any way to handle multiple substitutions in a single operation that works regardless of the substitution pattern, please tell me so. Of course, if you can combine your substitutions into a single regular expression operation that will be ok, but I think that is only possible sometimes and not "universal".