On Tue, Feb 05, 2008 at 05:42:28PM -0500, Mark J. Reed wrote: : On Feb 5, 2008 5:34 PM, Darren Duncan <[EMAIL PROTECTED]> wrote: : > >+ my $a = 0; my @b; : > >+ ($a, @b[$a]) = 1, 2; : > >+ : > >+assigns 2 to @b[0], not @b[1]. : > : > Personally, I think this is a particularly welcome change. : : It is certainly less surprising, I'd say. But is there a LET* : analogue to do it the old way if we want to?
I don't think so, at least not without writing a macro. The only think like it would be the fact that signatures bind right to left, so defaults can refer to previous parameters. But a signature doesn't allow you to declare a slice of an existing array. Possibly you could write something like: (lazy { $a }, lazy { @b[$a] }) = 1,2; and get away with it someday. But pugs doesn't currently allow you to lazily return an lvalue, it seems... Oh wait, I lied. You can get pugs to do it with: my $a = 0; my @b; (lazy { VAR($a) }, lazy { VAR(@b[$a]) }) = 1,2; say @b.join(':') Now just put that in a macro... Larry