# assuming @array1 contains the values to change. my @array2 = @array1; @array2 = map { s/\s//g; $_ } @array2; print @array2;