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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

show all hash keys in ref

Status
Not open for further replies.

arcnon

Programmer
Aug 12, 2003
242
US
whats wrong with this

foreach my $key (key (@$allMyItems[$ITEM_array_number]->{main}{item_rules})){
print "$key\n";
}
 
And keys requires a hash as its argument, which I don't see here. You're going to need to dereference the hash. I think you'd need something more like

foreach my $key (keys %{$allMyItems->[$ITEM_array_number]->{main}{item_rules}}) {
print "$key\n";
}

though this is somewhat guesswork since I don't really know your data structure.




 
in this case when I add items to the sub structure

@$allMyItems[$ITEM_array_number]->{main}{item_rules}{newHash}= $hash_value

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top