in reply to removing a hash from an array of hashes
use strict; use warnings; use Data::Dumper; my @successarray; for my $value (182,1000,201,300,124,1000,201,300,124) { push @successarray, {ydayopen => $value} } my $fromopenmove = 200; for (my $i = 0;$i < @successarray;$i++) { if ($successarray[$i]->{'ydayopen'} > $fromopenmove) { splice(@successarray,$i,1); $i--; # This is the part that you might not think of } } print Dumper(\@successarray);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: removing a hash from an array of hashes
by BrowserUk (Patriarch) on Dec 13, 2010 at 16:48 UTC | |
|
Re^2: removing a hash from an array of hashes
by Conal (Beadle) on Dec 13, 2010 at 17:01 UTC |