in reply to Re: Re: Re: Re: RFC - inplace upgrade for Tie::SortHash
in thread RFC - inplace upgrade for Tie::SortHash

Yes, and its exactly equivelent to

return $self->[ARRAY][$index];

What is the point of the if in your code? If the values of $self->[ARRAY][$index] is defined then we return the value. If its not then we return undef. Whats the point? The value of $self->[ARRAY][$index] should simply be returned. There is no difference. (Except the one is more efficient and less confusing.)

Consider this using different values:

sub foo { my $x=shift; if ($x=10) { return 10; } else { return $x; } }

Which is just plain silly isn't it?


---
demerphq

<Elian> And I do take a kind of perverse pleasure in having an OO assembly language...

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: RFC - inplace upgrade for Tie::SortHash
by Limbic~Region (Chancellor) on Sep 05, 2003 at 22:38 UTC
    demerphq,
    Ok - you are embarrasingly correct. My issue was confusing hashes and arrays. Trying to avoid auto-vivication. /me hangs his head in shame, but thanks demerphq for being persistent until the lightbulb went off.

    Cheers - L~R