Jonathan Scott Duff skribis 2005-05-14  9:49 (-0500):
> Then surely           $leaf = [.{}] %hash, $k1, $k2, $k3
> is the same as                $leaf = %hash .{} $k1 .{} $k2 .{} $k3

Then perhaps the easy way out is to make .{} $key and .[] $index valid
syntax.

Or perhaps [] can play the role of infix list operator, to support
postcircumfixes: 

    my $leaf = %hash [.{}] @keys

>       $leaf_value = [$^a.{$^b}] %hash, @keys;

Once arbitrary expressions are valid in [], its purpose is lost as a
meta-operator. You can write the above with "normal" reduce:

    my $leaf = reduce { $^a.{$^b} }, \%hash, @keys;

Since writing that line, I understand how adding a \ can make Damian's
example work (provided that postcircumfix operators are supported in
that way). I wasn't realising that %hash.{$k1} would of course be
another hashref. Somehow I was thinking about a string.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Reply via email to