The following is legal perl:

  print "$a $b $c" if ($a,$b,$c)=(1,2,3);

This prints "1 2 3", but the definitions obviously aren't scoped to the modified statement. And a C<my> in the modifier is a bit too late.

Any reason to [not] add a C<where> statement modifier which restricts the scope of the declarations? Sure its redundant, but so are all statement modifiers. Sometimes its good to factor things out and express them later, rather than earlier. It lets us focus on the important things first:

  print "$a $b $c" where ($a,$b,$c)=(1,2,3);

(in this case, we could use printf to to the factoring, but that's not a general solution).

Reply via email to