Conal has asked for the wisdom of the Perl Monks concerning the following question:
I have tried the delete method. I realise its is deprectated.push @successarray, { 'hour' => $hour, 'begintime' => $dbfirsttime, 'd +iff' => $diffstring, 'maxDD' => $maxDDL, 'maxDDTF' => $maxDDTF, 'time +frames' => $timeframe, 'maxtpTF' => $timeframe, 'maxtp' => $maxtp, 'y +dayopen' => $ydayopen, 'ydaydiff' => $ydaydiff};
this seems to work but leaves undefined 'gaps' in my arrays e.gfor $i ( 0 .. $#successarray ) { if ($successarray[$i]->{'ydayopen'} > $fromopenmove) { delete $successarray[$i]; } }
I have played with the splice method a little, as this seems a more suitable function, but i cant for the life of me work out the syntax. can anyone please help point me in the right direction? thanks{ hour=22 maxDDTF=2 maxtp=143 ydaydiff=182 ydayopen=-53 diff=-34 -14 - +2 1 -11 maxtpTF=13 maxDD=29 timeframes=7 begintime=2010-05-27 22:30:0 +0 } { hour=14 maxDDTF=6 maxtp=42 ydaydiff=182 ydayopen=-71 diff=1 -43 -23 +-13 maxtpTF=23 maxDD=34 timeframes=14 begintime=2010-05-28 14:00:00 } { } { } { } { } { hour=03 maxDDTF=1 maxtp=184 ydaydiff=124 ydayopen=-51 diff=2 1 -12 1 + 4 -28 -16 maxtpTF=48 maxDD=1 timeframes=2 begintime=2010-06-15 03:00 +:00 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: removing a hash from an array of hashes
by moritz (Cardinal) on Dec 13, 2010 at 15:03 UTC | |
|
Re: removing a hash from an array of hashes
by cdarke (Prior) on Dec 13, 2010 at 16:13 UTC | |
by BrowserUk (Patriarch) on Dec 13, 2010 at 16:48 UTC | |
by Conal (Beadle) on Dec 13, 2010 at 17:01 UTC | |
|
Re: removing a hash from an array of hashes
by Marshall (Canon) on Dec 13, 2010 at 23:28 UTC |