in reply to Hash/array madness
I have no idea what I did wrong!
I don't either. The code you posted is correct (although the style is a little rough.) I suspect you are doing something else you aren't telling us about if the hash you reference really ends up being what you say. I suggest using Data::Dumper to take a look at what you really have.
Update: I double checked myself. I cut and pasted the code you provided and used Data::Dumper as I suggested. The output was exactly what I expected:
$VAR1 = { 'foo' => [ 'bar', 'and', 'something', 'else' ], 'this' => 'that', 'somekey' => { 'foo' => $VAR1->{'foo'} } };
As you can see, $VAR1->{'foo'} is exactly equal to $VAR1->{'somekey'}{'foo'} as they both refer to the same array. You should, BTW, keep that in mind if you change an element of that array. Do you want $our_hash->{'somekey'}{'foo'} to refer to the same array referred to by $our_hash->{'foo'} or do you want it to refer to an array which is a copy of the one referred to by $our_hash->{'foo'}?
-sauoq "My two cents aren't worth a dime.";
|
|---|