- or download this
>perl -c -Mstrict -we"if (my $r = f()) { g() } print($r);"
Global symbol "$r" requires explicit package name at -e line 1.
-e had compilation errors.
- or download this
>perl -c -Mstrict -we"if (my $r = f1()) { g1() } elsif (my $r = f2())
+{ g2() }"
"my" variable $result masks earlier declaration in same scope at -e li
+ne 1.
-e syntax OK
- or download this
>perl -c -Mstrict -we"{ my $r = f(); if ($r) { g() } } print($r);"
Global symbol "$r" requires explicit package name at -e line 1.
-e had compilation errors.
- or download this
>perl -le"sub f { 1 } for (1..2) { if (my $r = f()) { next } print '
+!' }"
>perl -le"sub f { 1 } for (1..2) { { my $r = f(); if ($r) { next } }
+ print '!' }"
!
!