in reply to Potential Tie::Memoize Bug

I can't explain the second issue, but the first is your bug. Returning undef explicitly to indicate falsehood is almost always an error. There are two circumstances where it's okay:

I don't think the second case is that useful; bare return does the right thing for you.

Replies are listed 'Best First'.
Re^2: Potential Tie::Memoize Bug
by satchm0h (Beadle) on Mar 17, 2005 at 01:22 UTC
    sub foo { return; } @ret = foo(); die "Not a Bug\n" unless @ret; print "Doh...shouldn't get here!\n"
    Results:
    Not a Bug
    Excellent! Thanks chromatic !

    I still find it curious that he calls the exists function in list context. I can't imagine I'm the only one who has been bitten by this.

    From the return perldoc for those too lazy to look it up themselves:

    return EXPR .......snip....... If no EXPR is given, returns an empty list in list context, the undefined value in scalar context, and (of course) nothing at all in a void context.