Help for this page

Select Code to Download


  1. 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.
    
  2. 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
    
  3. 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.
    
  4. 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 '!' }"
    !
    !