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". ;-)