Replacing part of @array with the elements from @array2
@array = ( 0 .. 20 );
@array2 = ( A .. F );
print "\@array: @array\n";
print "\@array2: @array2\n\n";
@replaced = splice( @array, 5, scalar( @array2 ), @array2 );
print "replaced: @replaced\n",
"with: @array2\n",
"resulting in: @array\n\n";
Related examples in the same category