[Kc] Re: when multidim emulation works

Nick Ing-Simmons nick.ing-simmons at elixent.com
Mon May 12 02:56:49 CDT 2003


David Nicol <whatever at davidnicol.com> writes:
>Is this a bug?
>
>% perl -le '$e{(0,1,2,3)} = 3; @a=(0,1,2,3); print $e{@q=@a}'
>
>% perl -le '$e{(0,1,2,3)} = 3; @a=(0,1,2,3); print $e{@a}'
>
>% perl -le '$e{(0,1,2,3)} = 3; @a=(0,1,2,3); print $e{0, at a[1,2,3]}'
>3
>% perl -le '$e{(0,1,2,3)} = 3; @a=(0,1,2,3); print $e{$a[0], at a[1,2,3]}'
>3
>
>
>Well it is, because it isn't DWIM; but the question is, is
>$e{@a} supposed to interpolate $; or not?  I want it to and
>it doesn't seem to.

If you want a list back from %e you need to write @e{@a} 
Otherwise index is evaluated as a scalar and scalar(@a) is 4 and you have 
no $e{4} 

-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/




More information about the kc mailing list