Yitzchak Scott-Thoennes wrote:
To set it, you need to just do the same thing except that at each step
instead of keeping the hash element, you keep a reference to it:
$entryref = \$hash;
$entryref = \$$entryref-{$_} for @a;
$$entryref = 1;
Note that this will create hashrefs at any undefined
On Tue, Mar 29, 2005 at 11:45:01AM +0200, Alexandre Jousset wrote:
Yitzchak Scott-Thoennes wrote:
To set it, you need to just do the same thing except that at each step
instead of keeping the hash element, you keep a reference to it:
$entryref = \$hash;
$entryref = \$$entryref-{$_} for @a;
Yitzchak Scott-Thoennes wrote:
I'm sorry but that doesn't work as is on my system: Not a HASH
reference at x.pl line 9..
Works for me. Can you show the actual code you are trying?
In fact I made a mistake. Sorry again, you're right ! :-)
--
\^/
-/ O
wrote:
[snip code...]
gives:
$VAR1 = {
'E1' = {
'E2' = {
'E3' = {
'En' = 1
}
},
'E3' = {
Alexandre Jousset wrote:
Andrew Pimlott wrote:
(You should be able to write the first one as
${fold_left { \${$_[0]}-{$_[1]} } \$hash, @a} = 1;
Is it a copy/paste or a retype ? Because there's a comma missing after
the first closing brace...
but Perl complains for no reason I can see.)
--
On Tue, Mar 29, 2005 at 06:42:41PM +0200, Alexandre Jousset wrote:
Alexandre Jousset wrote:
Andrew Pimlott wrote:
(You should be able to write the first one as
${fold_left { \${$_[0]}-{$_[1]} } \$hash, @a} = 1;
Is it a copy/paste or a retype ? Because there's a comma missing
Zhuang Li writes:
Yes. I think it's both useful and fun. I was thinking something similar
to
@[EMAIL PROTECTED] = map{1} @a;
But getting $hash-{E1}-{E2}-...-{En} = 1; instead of $hash{E1} =
1; ... $hash{En} =1;.
Yeah, like this:
%hash{dims @a} = (1) xx Inf;
What I'd really like to
-Original Message-
From: Luke Palmer [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 29, 2005 5:43 AM
To: Zhuang Li
Cc: Jeff Yoak; fwp@perl.org; perl6-language@perl.org
Subject: Re: Unknown level of hash
Zhuang Li writes:
Yes. I think it's both useful and fun. I was thinking