no warnings; my $lex = 4; # file scoped lexical #--- normal # inner scope sub with_proto () { my $lex } # outer scope { my $lex = 4; sub with_proto() { $lex } } # file scope sub with_proto() { $lex } #--- reference # inner scope sub with_proto() {\ my $lex } # outer scope { my $lex = 4; sub with_proto() {\ $lex } } # file scope sub with_proto() {\ $lex } #------ lvalue #--- normal # inner scope sub with_proto() :lvalue { my $lex } # outer scope { my $lex = 4; sub with_proto() :lvalue { $lex } } # file scope sub with_proto() :lvalue { $lex } #--- reference # lvalue references are not feasible, because of # "Can't modify single ref constructor in lvalue subroutine" #------ overriding constant function throws always a warning sub with_proto () {4} # uncommenting garanties a warning # sub with_proto () {5}