hi,
I have an array I want to remove elements at different indexes, relative to the value of a key held in the hash.
i've seen this on other posts
does this have to be specified can I imply current location as follows.
Just thought I'd check before I ploughed ahead.
Thanks.
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
I have an array I want to remove elements at different indexes, relative to the value of a key held in the hash.
i've seen this on other posts
it seems they are using array, index(offset), lengthmy $index = 0;
while ($index <= $#items ) {
my $value = $items[$index];
print "testing $value\n";
if ( $value == 1 or $value == 3 ) {
print "removed value $value\n";
splice @items, $index, 1;
} else {
$index++;
}
}
does this have to be specified can I imply current location as follows.
Code:
for(@array){
if($_->{'key'} eq "value"){splice(@array);}
}
Just thought I'd check before I ploughed ahead.
Thanks.
1DMF
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.