Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array and hash problems. 2

Status
Not open for further replies.

peterneve

Programmer
Jan 24, 2002
50
GB
I am susing XML::Simple to read an XML file. I have forced it to use arrays, so I can access items like this:

Code:
  print "$config1->{level1}->[0]->{level2}->[0]->{level3}->[0]";

This is great, but level3 is a hash and I want the keys of the hash. If I use something like:

Code:
  %hash=$config1->{level1}->[0]->{level2}->[0];
  @keys=keys(%hash);

I just get: HASH(0x23a11d4)

I know this probably just need dereferencing somehow but I can't work it out.

Any ideas? ;-)

Thanks in advance...
 
Maybe:
Code:
%hash=[COLOR=red]%{[/color]$config1->{level1}->[0]->{level2}->[0][COLOR=red]}[/color];
@keys=keys(%hash);

--------------------

Denis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top