in reply to array with s///g command

Without the .= statement, that should do the trick, assuming your
@array1 abc abc abc abc abc abc abc abc2 abc3 abc4 abc5 abc abc abc1 abc2
means
@array1 = ( 'abc abc abc abc abc', 'abc abc abc2 abc3 abc4 abc5', 'abc abc abc1 abc2' );
If it's not working, you need to be more explicit with us (and yourself?) about what's in your array, for instance, by showing the output of
use Data::Dumper; $Data::Dumper::Useqq=1; print Dumper \@array;

Replies are listed 'Best First'.
Re^2: array with s///g command
by GrandFather (Saint) on Jul 30, 2007 at 00:05 UTC

    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. ;)


    DWIM is Perl's answer to Gödel