I need help creating a hash. I am Stumped!
Posted on 2003-03-27
I need to create a hash by parsing the following information. I would like my hash to look like this.
template:Actioncode => i
SBID => 100200401
BusName => Mikes System Test1
City => Douglas
State => MA
Zip => 01516
Phone => 5084742781
CategoryID => 14438
This is the information that I would be parsing in the file. The idea is to recreate the hash for each line below the template line.
I would greatly appreciate this. One thing to note is that the script would have to be dynamic becuase the template line wont always look like that. It could have extra fields. Thank you!
i|100200401|Mikes System Test1|Douglas|MA|01516|5084742781|14438
i|100200402|Mikes System Test2|Douglas|MA|01516|5084742782|14438
i|100200403|Mikes System Test3|Douglas|MA|01516|5084742783|14438
i|100200404|Mikes System Test4|Douglas|MA|01516|5084742784|14438
i|100200405|Mikes System Test5|Douglas|MA|01516|5084742785|14438
Here's all i got now.
# open up the text file to parse.
open (IUD, "SomeTextfile.txt") or die "Can't open textfile: $!";
# create my hash