Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Array problems.....

by NetWallah (Abbot)
on Mar 19, 2013 at 03:20 UTC ( #1024192=note: print w/ replies, xml ) Need Help??


in reply to Array problems.....

This problem is better solved with a hash structure.

The algorithm would be:

  • Open the file
  • In a loop, read the input
  • chomp, then split the input on white space
  • use the last field as a hash key, and "push" the first field into the HOA (Hash-of-Arrays) structure (Please research HOA at this site)
  • End loop (Keep reading till you have all info)
  • Loop through the collected hash structure, and print the info
Let us know if you have a specific issue with your implementation of this algorithm.

             "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
        -- Dr. Cox, Scrubs


Comment on Re: Array problems.....

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024192]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2014-12-18 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (58 votes), past polls