Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: return if defined

by AnomalousMonk (Abbot)
on Dec 20, 2012 at 13:42 UTC ( #1009746=note: print w/ replies, xml ) Need Help??


in reply to Re^2: return if defined
in thread return if defined

Clever, but maybe a little too clever. This isn't the clearest construct in the world ...

But I thought the whole point of the OP was to be too clever by half, and clarity be damned.

IMHO, the pair of statements
    my $existing_result = $self->find_by_something(@args);
    return $existing_result if (defined $existing_result);
is perfectly clear and sufficiently unclever to help me avoid future foot trauma.


Comment on Re^3: return if defined
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-11-27 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (186 votes), past polls