Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Copying a hash to another hash problem

by demerphq (Chancellor)
on Oct 22, 2002 at 16:11 UTC ( [id://207121]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Copying a hash to another hash problem
in thread Copying a hash to another hash problem

i'm using numeric values for both keys and values

Well, this isnt intrinsically a bad thing. But more often than not it is.

The reason I say this is because if your indexes are sparse, ie 1, 500,623,7439,104029 or the like, then a hash is a much more suitable container type than an array is. (A hash would store the above usin 5 slots in a hash, an array would store at minimum 104029 elements.) However if the array is dense, 1..9,11..19,21..29 etc then an array is a more suitable approach. (Each slot in a hash is bigger than in an array, so even with the 4 wasted slots in the array would still be much smaller than the 26 allocated slots in the hash.)

Also, the difference isnt so much due to what you store in the values, but what you store in the keys.

Good luck and dont forget strict. :-)

--- demerphq
my friends call me, usually because I'm late....

  • Comment on Re: Re: Re: Copying a hash to another hash problem

Replies are listed 'Best First'.
Re: Re: Re: Re: Copying a hash to another hash problem
by Anonymous Monk on Oct 23, 2002 at 07:41 UTC

    Maybe I should have given an explanation of my requirements.

    Basically, I have a NAS setup with 700+ disks contained within 45 drawers split over 7 frames that I want to watch the temp on.
    The code queries the drawers one by one and maps which drawers are in which frames and collects the current temp(also producing a pictorial map of the system).

    So the array would only ever contain a max of (7) for the frames and (1-8) for the drawers within the frames (as not all frames have the same no. of drawers).

    The copying (or snapshot) of the array was for comparing against the next time the prog went to check the temp to inform me of differences.

    Cheers

    Sean

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-26 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found