in reply to Re: foreach-loop-local var in sub
in thread foreach-loop-local var in sub
FYI, Perl 5.18 will have experimental implementations of my sub, state sub and our sub. our sub is effectively the same as the existing sub keyword but can also be used to hide my sub subs, a la:
use 5.010; our $foo = 42; my $foo = 99; say $foo; # says 99 our $foo; # "hides" my $foo say $foo; # says 42
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: foreach-loop-local var in sub
by muba (Priest) on Jan 22, 2013 at 06:23 UTC | |
by LanX (Saint) on Jan 22, 2013 at 18:20 UTC | |
by muba (Priest) on Jan 22, 2013 at 19:36 UTC |
In Section
Seekers of Perl Wisdom