Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: What would be the easier way

by james2vegas (Chaplain)
on Mar 04, 2013 at 01:00 UTC ( #1021552=note: print w/ replies, xml ) Need Help??


in reply to What would be the easier way

Use a hash table with an array ref for each entry, doing something like push @{ $height{$input} }, $value; after parsing each line into $input and $value; leaving you with something like this:

%height = ( 'house' => [ string1, string2 ], 'table' => [ string3, string4 ] )
and @{$height{house}} would be all the values for house in an array


Comment on Re: What would be the easier way
Select or Download Code
Replies are listed 'Best First'.
Re^2: What would be the easier way
by zee3b (Novice) on Mar 04, 2013 at 01:12 UTC
    hey, im sorry i didnt really get that since ive started using perl recently, can you explain this part to me a little @{ $height{$input}} What will my array be called then? Thanks!
      @{ $whatever } de-references the array ref $whatever so you can use the reference as an array. Your data are contained in array references which you need to de-reference with @{ } to use as arrays.
        That is not an array, but an array reference.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (18)
As of 2015-07-31 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (278 votes), past polls