Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: Hashing multiple items

by Anonymous Monk
on Nov 15, 2003 at 17:43 UTC ( [id://307341]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Hashing multiple items
in thread Hashing multiple items

I actually want to do thngs the other way around. I want to have the zone as the key. So that I could say, print out out all the coorsinates in zone B1. Doing this -
$coordinates{$zone} = $a1,$a2,$b1,$b2)
will only allow my to save one coordinate for a particular zone. How do I save an arbitary bumber of coordinates for each zone?

Replies are listed 'Best First'.
Re: Re: Re: Re: Hashing multiple items
by CombatSquirrel (Hermit) on Nov 15, 2003 at 17:54 UTC
    Use an anonymous array as value:
    $coordinates{$zone} = [ $a1, $a2, $b1, $b2 ];
    Don't forget to dereference it when you read your coordinates back out:
    ($a1, $a2, $b1, $b2) = @{$coordinates{$zone}}
    Have a look at perlref and perlreftut.
    Hope this helped.
    CombatSquirrel.
    Entropy is the tendency of everything going to hell.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-26 03:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found