in reply to Re^2: deleting elements in nested hash structure
in thread deleting elements in nested hash structure
last; # <<<< Added 'last' to avoid deleting $first multiple times
It doesn't change the result, but yes, it is a more optimal implementation. I wouldn't code it that way though.
Whilst if( noOverlap ) { do nothing } else { push @todelete }
is functionally equivalent to push @toDelete unless noOverlap;
I find the latter easier on both the eye and the brain.
Hence, I#ll modify the above this way:
push( @toDelete, $first ), last unless $tss{ $ids[ $first ] }{ start } > $tss{ $ids[ $seco +nd ] }{ stop } or $tss{ $ids[ $first ] }{ stop } < $tss{ $ids[ $seco +nd ] }{ start };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: deleting elements in nested hash structure
by NetWallah (Canon) on Jun 02, 2012 at 23:28 UTC | |
by BrowserUk (Patriarch) on Jun 02, 2012 at 23:37 UTC |