in reply to Text Analysis: given(){when(){}} block throws a 'useless use of private variable...etc' error
>perl -wMstrict -lE "my ($foo, $bar) = qw(FOO BAR); given ($foo) { when ($foo eq 'FOO') { print 'got a FOO'; } } " got a FOO >perl -wMstrict -lE "my ($foo, $bar) = qw(FOO BAR); given ($foo, $bar) { when ($foo eq 'FOO') { print 'got a FOO'; } } " Useless use of private variable in void context at... got a FOO
See Switch statements in perlsyn.
|
|---|