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

Re^5: More efficient dereferencing of a subroutine return

by Anonymous Monk
on Feb 18, 2013 at 00:24 UTC ( #1019246=note: print w/replies, xml ) Need Help??

in reply to Re^4: More efficient dereferencing of a subroutine return
in thread More efficient dereferencing of a subroutine return

That is what you said, but look at the OP's code, its always  return \@array which can never be undef

an empty array is better than undef

Replies are listed 'Best First'.
Re^6: More efficient dereferencing of a subroutine return
by parv (Priest) on Feb 18, 2013 at 00:49 UTC

    It seems you and I read the representation of the problem differently. Your reply presumes that every return from sub is always a return of an array reference. (If that promise is made to the user of the sub, then I have no disagreement with direct dereferencing of the return value.) I think of the value returned being an array reference where possible; else, nothing or undef is returned.

      Look, no temporaries, no fatal :) my @stuff = eval { @{ func() } };

        Can you please stop being Anon and create an account?

        It helps those of us ( read - me ) who want to follow your, often informative, responses.

        You have my vote.-)
        You have my vote.-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019246]
[choroba]: Corion Nice
[Corion]: Hi choroba! I'm somewhat fond of this picture - I think it is Breaking Bad-style even though I haven't watched the series at all ;)
[Corion]: Hmmm - and now that I look at it, the gallery I'm using doesn't produce non-Javascript compatible links in the sense that hotlinking to an image will only work for Javascript enabled...
[Corion]: On the other hand, maybe supporting non-Javascript isn't that much a priority, and I'm not exactly sure how I could make it work for both kinds of browsers without server-side magic

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2017-02-27 08:32 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (377 votes). Check out past polls.