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

referencing a hash 1

Status
Not open for further replies.

snookmz

Programmer
Apr 17, 2001
46
AU
g'day all

I want to access a hash table based on what value is in a particular string.. i.e.

%"$string"{$key} = "such and such";

can this be done?? And if so whats the correct syntax??

any help will be gratelly appreciated.. thanks in advance :)
/-------------------------------------
| I always have been, and
| always will be, a newbie :)
\-------------------------------------
 
You want the string to contain the NAME of the hash? This is the correct syntax to do that:
Code:
${$string}{$key} = "value";
The curly brackets around the $string may not be required in this case, but they don't hurt. They would be required if part of the hash name was a literal and part was a variable, like ${"hash_".$string}. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top