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);