in reply to Overloading oddity

Try this:
sub name { $_[0]{NAME} = $_[1] if defined $_[1]; $_[0]{NAME}; }

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Re: Overloading oddity
by theguvnor (Chaplain) on Jan 28, 2004 at 14:47 UTC
    Good on you dragonchild. I tend to not work with elements of @_ directly as I'm always afraid that the "readability police" will get me ;-) but that snippet is fairly clean and clear. Always good to make the brain re-examine its assumptions. Thanks.

    [Jon]