On Jun 22, 2005, at 2:25 PM, Klaas-Jan Stol wrote:
I have some trouble indexing hashtables.
I have the following code snippet:
x["y;a"] = $P10 # (1) this does not work with the code below
y["a"] = $P10 # (2) this does work with the code below
x.y.a = 1;
print(x.y.a);
x and y are both hashtables.
x has a field "y", storing y
y has a field "a", storing an integer
I'd like to get the field "a" step by step, so first get a reference
to x.y, then get a reference to y.a, instead of indexing at once with
"y;a" as done at (2). Doing it step by step makes generating code a
bit easier, in my opinion.
I'm wondering what I'm doing wrong, because it looks like it should be
working (right?)
I'm just guessing here, but doesn't #1 above add 1 to x with key "y;a"?
For example, if your intention in Perl 5 was '$x->{y}{a} = 1', doesn't
#1 mean '$x->{"y;a"} = 1'?
Josh