http://qs321.pair.com?node_id=268558


in reply to Optimizing the bejeezus out of a sub

Is this really what you want to do? If $val is defined, print it. Otherwise, pass undef and a string concatenated with undef to a subroutine. I suspect your code has never branched to that case, since it is almost certainly a bug.
print $fh defined($val) ? $val : $self->_nosuchvar($val,"\$".$val);

Replies are listed 'Best First'.
Re: Re: Optimizing the bejeezus out of a sub
by sgifford (Prior) on Jun 24, 2003 at 16:29 UTC

    No, you're right; I introduced that error while optimizing. It should be:

    print $fh defined($val) ? $val : $self->_nosuchvar($v->[_contents], "\$".$v->[_contents]);
    Thanks!