Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: For clarity and cleanliness, I'd recommend...

by merlyn (Sage)
on Mar 05, 2005 at 19:40 UTC ( #436953=note: print w/ replies, xml ) Need Help??


in reply to For clarity and cleanliness, I'd recommend...
in thread looking for a good idiom: return this if this is true

Aha! I knew it merely took the electron spin reversal of the other side of the world to solve this correctly! Thanks. That's the version that goes into the example now.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


Comment on Re: For clarity and cleanliness, I'd recommend...
Re^2: For clarity and cleanliness, I'd recommend...
by saskaqueer (Friar) on Mar 06, 2005 at 08:05 UTC

    This works fine, and does not clobber $_.

    #!/usr/bin/perl -w use strict; print test(), $/; sub subtest { return 4 } sub test { return $_ if ( local $_ = subtest() ); # continue return 'false'; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2014-11-23 18:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls