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

creating an reference to an anonymous hash from ARGV 1

Status
Not open for further replies.

ianfo

Programmer
Aug 20, 2002
29
GB

Hi,

Does anyone know the easiest way to create a reference to an anonymous hash using the values in ARGV to populate the keys for the hash?

for example. if my program was called like this

./prog A B C D

How would I then create a ref to an anonymous hash with keys A B C D (but with no associated values at this point)

Hope i've worded that correctly!

 

$anon_hash_ref = {};

$anon_hash_ref->{$_} = "" for (@ARGV);

Hope that helps.

--jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top