On Mon, Apr 18, 2005 at 06:01:48PM -0700, Dave Whipp wrote:
: 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?

Already used "where" for subtype constraints.

: 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).

Okay, here's a slightly more general solution:

    { print "$^a $^b $^c" }.(1,2,3);

Larry

Reply via email to