in reply to Re: Optimization, side-effects and wrong code
in thread Optimization, side-effects and wrong code

agreed, I've added exists which causes it to work correctly (albeit a bit different test than the OP's). Could maybe even add a check to make sure our while loop doesn't run past scalar(keys %$self) but then we're back to using keys again... :-)