Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: looking for a good idiom: return this if this is true

by redlemon (Hermit)
on Mar 10, 2005 at 13:47 UTC ( #438245=note: print w/ replies, xml ) Need Help??


in reply to looking for a good idiom: return this if this is true

if you wouldn't mind refactoring thatroutine, this works:

sub thatroutine(\$) { # do something to ${$_[0]} } sub thisroutine { return $_ if thatroutine local $_; ... my $namedvar; return $namedvar if thatroutine $namedvar; }
Ugly as hell but it appears to work.


Comment on Re: looking for a good idiom: return this if this is true
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-07-07 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls