ãã£ããããï¼ï¼
id:tokuhirom ã« Perl ã® local 㨠my 㨠our ãåãç°¡æ½ã«åããæãè¨èã§æãã¦ãããã¾ããã
our ååãã¹ã³ã¼ãã«éå®. local å¤ãã¹ã³ã¼ãã«éå®. my ååã¨å¤ã®ä¸¡æ¹ãã¹ã³ã¼ãã«éå®
追è¨
å
ãã¿ã¯æ©å·ããã ããã§ãï¼ï¼
âPowerPoint ãã¬ã¼ã³ãã¼ã·ã§ã³
ã¨ãã²ããã¼ãããæ©å·ããããããã¨ããããã¾ãã
ã§ãã¤ãã§ã«å®è·µãã¦ã¿ã¾ããã
$foo = "global"; sub func{ print "func $foo\n"; } sub test1{ my $foo = "my"; func(); } sub test2{ local $foo = "local"; func(); } test1(); print "after my $foo\n"; test2(); print "after local $foo\n"; my $bar = "my"; sub test3{ our $bar .="our"; print "in our $bar\n"; } print "$bar\n"; test3(); print "$bar\n"; test3(); print "$bar\n"; test3();
çµæ
func global after my global func local after local global my in our our my in our ourour my in our ourourour
ãã£ãã¼ã¼ã¼ãã£ãããã¾ããã
ãããã¨ããããã¾ãâª