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

How can i use HashMap in PERL?

Status
Not open for further replies.

Bhavani2007

Programmer
Jul 24, 2007
5
IN
Hi,

I have one xml file like following...
<State CollType="A" Letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ" State="AK" Team="TEAM2"/>
<State CollType="A" Comment="Military addresses" Letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ" State="AE" Team="TEAM2"/>
<State CollType="M" Letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ" State="AK" Team="TEAM3"/>
..........
...........

I need to read this xml file in perl and use this data in that perl class file.

in perl,i will read line by line.
when i read first line then i need to write like:

condition for colltype
if it is 'A' take A_map and put state and team values as key value pairs in that map.

if it if 'M' take M_map and put state and team values as key value pairs.

like so on....
and in perl file i have state and colltype values as input.
first i will check colltype value.
if is 'A' then check for state
if it is 'AK' then A-map.get('AK');then
we will get the team value.

This is my requirement.
I know how to do in java but i dont know how to do in perl?
can anybody help me please?

Thankyou very much in advance.



 
Your question is covering a lot of different topics. You best course of action is probably to use one of the XML parsing modules, maybe XML::parser but I have little practical experience working with XML so maybe someone else will contribute a suggestion.



------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top