Assigning many smaller values to a parent one, and having many parent values.

Can't Post

To begin I apologize for the title of this post, Im new to Perl and didn't really know what to call this one. This is what my file looks like US MSFT ----------- UN JNJ ----------- US ORCL ----------- CA LLBT ----------- UN TNBI ----------- Basically I need a bit of code that takes all of the 4 charecter entries that share the same 2 charecter ones (US,UN,CA) and puts them in a list that that would look something like this US_: "MSFT","ORCL" UN_:"TNBI", "JNJ" CA_:"LLBT" Ive heard about printf and sprintf and maybe those would help, or perhaps a hash, although Ill have to alphabetize the lists later on. I really appreciate any help on this, so far Ive been very impressed with this community and how much Ive learned!

Re: [AndrewF] Assigning many smaller values to a parent one, and having many parent values.
[In reply to]

Can't Post

You'll want to use a HoA (Hash of Arrays) to store the data.

If your data is consistent in its format, I'd read-in the file in record mode using '-----------' as the record separator. Then split the record on the \n char to extract the key/value pair to be used in the hash.