Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^3: return if defined

by AnomalousMonk (Canon)
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.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2016-10-21 01:58 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (284 votes). Check out past polls.