in reply to changing array elements


Here is one way of doing it using grep.
#!/usr/bin/perl -w use strict; my @array = ([1], [2], [3], [4], [5]); my %skip = (3 => 1); my @keep = grep {not exists $skip{$_->[0]}} @array; my @skip = grep { exists $skip{$_->[0]}} @array; my @new = (@keep, @skip);

If the array of data is very large it may be inefficient to use two calls to grep. In which case a while loop solution as shown by grinder would be better.

--
John.