That will update @array1. OP implied that @array2 should have the updated strings. Of course it may be that OP intended the two arrays to actually represent the contents of an unspecified array at two different time, in which case:
s/\s+//g for @fields;
may be what OP is looking for.
I find it a little tricky to read some OP's minds at times. ;)
In reply to Re^2: array with s///g command
by GrandFather
in thread array with s///g command
by convenientstore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |