develooper Front page | perl.beginners | Postings from August 2009

Convert Array's into hashes

Thread Next
From:
jet speed
Date:
August 6, 2009 03:20
Subject:
Convert Array's into hashes
Message ID:
b43e0e600908060319q3757a7fesd8c6212172c6a7a1@mail.gmail.com
Hi,

I have a query on converting arrays into hash.Please could you help me
resolve the below.

I have 2 arrays as bleow.

@array1 = ( D_101 D_102 D_103 D_104);
@array2 = (0 1 2 3);


How can i convert both of these arrays into %hash, assigining the
@array1  as keys and @array2 as values.
How can I recall only certain keys and their corresponding values of hashes
ex : if D_103 then print " D_103 value is 2"
ex :if D_101 then print "D_101 value is  0"

any help on this would be much appreciated.

Many Thanks
Sj

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About