473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Hash of Hashes, Hash of Arrays and Hashes

eWish
971 Expert 512MB
I am in need of a good tutorial that explains taking the keys of one hash and the elements in a HOA and making them a HOH. I have a file that has is pipe delimited with 374 fields per line and 7.500 plus lines per file. I have about five of these files. I need to get this into a database and did not want to do it manually, Preserving the order is crucial. I am using Tie::Hash::Indexed to keep the order.

Basically, $HOH{$key_of_HOA}->{$key_of_hash} = $element_from_HOA;

I have tried using nested for loops without success.

Any suggestions?

--Kevin
Jan 14 '09 #1
2 3545
numberwhun
3,509 Expert Mod 2GB
@eWish
Don't know if you have seen this one yet, but here is one of my go-to pages for hash of <anything>.

Hope it helps!

Jeff
Jan 14 '09 #2
eWish
971 Expert 512MB
Here is what I ended up doing.

Expand|Select|Wrap|Line Numbers
  1. foreach my $id (keys %listings) {
  2.      my $count = 0;
  3.         foreach my $field (keys %fields) {
  4.             $count++;
  5.             $data_hash{$id}->{$field} = $listings{$id}[$count-1];
  6.  
  7.         }
  8.  
  9. }
--Kevin
Jan 14 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: andreas gammel | last post by:
I want to use Perl hash functionality (hashes of hashes, arrays of hashes, hashes of arrays) in my C programs. Other Perl functions (split, chomp, regular expressions) would be welcome too. ...
47
by: VK | last post by:
Or why I just did myArray = "Computers" but myArray.length is showing 0. What a hey? There is a new trend to treat arrays and hashes as they were some variations of the same thing. But they...
22
by: VK | last post by:
A while ago I proposed to update info in the group FAQ section, but I dropped the discussion using the approach "No matter what color the cat is as long as it still hounts the mice". Over the last...
1
by: bb | last post by:
I have a requirement to create and store in our database the users password in a couple of additional hashes (we currently store an MD5 hash) the spec is pretty brief... Spec: Store the NT...
14
by: John Coleman | last post by:
Greetings, I am currently trying to learn Python through the excellent "Learning Python" book. I wrote my first non-trivial program, which began with several comment lines. One of the comment...
3
by: John Gregory | last post by:
I'm new to perl and have a question. The perl book says that hashes map keys to values. Using the reverse function you can map values to keys. My problem is I have a hash of arrays and I want...
24
by: kdotsky | last post by:
Hello, I am using some very large dictionaries with keys that are long strings (urls). For a large dictionary these keys start to take up a significant amount of memory. I do not need access to...
11
by: merrittr | last post by:
Hi in the code below in the main the hash table from K&R example replaces a node when a collision occurs What I am trying to do is set it up to "chain" another structure beside the node that it...
4
by: MS | last post by:
Hi, I'm writing a PHP login script for a web site. I've looked at several examples on the web and some of them use MD5 hashes for the password. They do this in various ways. EG. a) Storing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.