Are you sure you want an array for the result? Your description and example look more like a string:
$concat = join ',', map {"!$_"} @array1;
If you really mean the array,
@array2 = map {"!$_,"} @array1;
chop $array2[-1];
That's the first time I've found chop useful ;-)
| [reply] [d/l] [select] |
Hi,
It's not clear what you really want. @array2 = !blue,!white,!yellow is not an array. May be you mean that you want $list = "!blue,!white,!yellow"; or @array2 = ( "!blue", "!white", "!yellow" );
The first can be done with:
$list = join ',', map { $_ = "!" . $_; } @array1;
But, probably you prefer:
foreach my $t (@array1) { push @array2, "!" . $t; ;
print join ",", @array2;
Hope this help you :)
| [reply] [d/l] [select] |