On Mar 25, 8:50 am, [EMAIL PROTECTED] (Sharan Basappa) wrote:
> Hi,
>
> Is there a way I can copy only part of an array into another array.
> For example, I want to copy only first 8 elements of source array
> into destination array.
>
> Regards

Hi,

You can use the splice( ).  See example:

#!/usr/bin/perl - w
use strict;
use warnings;

my @array1 = qw(1 2 3 4);
my @array2 = qw(3 4 5 6);

print "@[EMAIL PROTECTED]";
push(@array2,splice(@array1,2,2));
print "@array2\n";

Best,
Julia


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to