A1=0 1 2 3 4 5 6 7 A2=6 7 #### foreach my $A1 (@cpu_lists) @A2 = @{$A1}[-n..-1]; #A2 is derived from A1 @{$A1} = splice @{$A1},6,-1;#A1 should be spliced to remove elements of A2 where n = number of elements which we want in A2.