Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Optimizing the bejeezus out of a sub

by tall_man (Parson)
on Jun 24, 2003 at 15:42 UTC ( #268558=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://268558]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2022-01-22 17:58 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (63 votes). Check out past polls.