in reply to Help to assign a 2D-Array to another while excluding specific rows.
It sounds like you might want to use grep:
which returns "1245"my @array = (0,1,2,3,4,5); @array = grep {$_ % 3} @array; #replace $_%3 with whatever condition +applies. print @array;
You can chop one element out with a splice:
my @array = (0,1,2,3,4,5); my $cutme = <>; @array = @array[0..$cutme-1, $cutme+1..$#array]; print @array;
Entering "2" gives "01345", "0" gives "12345", and so on. Of course, doing so changes the indices of some of the remaining elements, so be careful with this one.
|
|---|