Perlについての質問箱 47箱目
■ このスレッドは過去ログ倉庫に格納されています
0593デフォルトの名無しさん
2011/07/13(水) 07:30:51.21とりあえず訳しました。
間違いがあればよろしくです。>皆さん
I wonder if it is not valid to give the warning of 'Variable "$_" is not available' when running the following code.
I can't figure out whether it's a proper warning or just a bug even after reading the perldiag.
Let me know the reason if it is proper.
It doesn't take place on Perl 5.12.
My platform is Win Vista x64 ActivePerl 5.14.1.1401 x64.
use 5.14.0;
use warnings;
sub main { # take place just in main()
given(1){ # take place just in "given"
default {
func(sub{ my $s='hoge';$s =~ m/./; say $s });
# doesn't take place without "m//". Also does with "s///" and "say"
# my $_; doesn't with this declaration
# func(sub{ my $_; my $s='hoge';$s =~ m/./; say $s });
}
}
}
sub func {
shift->();
}
main();
■ このスレッドは過去ログ倉庫に格納されています