in reply to Re: Re: Re: optimization - exists should return a reference
in thread optimization - exists should return a reference

Sorry Zaxo. I know I'm being thick here, but if the entity being testing for existance doesn't exist, exists can't return a reference to it. And if it did return a "false reference", you wouldn't be able to do anything with it except test it for being false, so it should just return false, whether that is undef, 0, or '' makes no difference. As long as it returns false, then existing code like

print exists( $foo{'bar'} ) ? 'Exists' : 'Doesn't exist';

doesn't break.

I'm sure I missing the salient point here, but I can't see where.


Examine what is said, not who speaks.

The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.