Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Hash (not) returned by subroutine

by karlgoethebier (Abbot)
on Jan 27, 2020 at 21:27 UTC ( [id://11111945]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Hash (not) returned by subroutine
in thread Hash (not) returned by subroutine

"...certain situations...return...optimized out"

Doesn’t such a method make the behavior of a programming language unpredictable? Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Replies are listed 'Best First'.
Re^4: Hash (not) returned by subroutine
by afoken (Chancellor) on Jan 27, 2020 at 23:41 UTC
    Doesn’t such a method make the behavior of a programming language unpredictable?

    Not if perl is sure that the situation allows optimizing out.

    I would blindly assume that all returns could be optimized out in this script:

    sub foo { # do something return; } sub bar { # do something return 'a scalar'; } sub baz { # do something return qw( a list ); } foo(); bar(); baz(); exit();

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-25 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found