On Wed, 27 Nov 2002, Ben Crane wrote:

> Hi all,
> 
> One quick Q about hashes:
> 
> they contain a key and data?
> e.g: %stuff=(A => 'one',
>              B => 'two');
> 
> where A and B are keys to data one and two...but what
> happens if you have a massive text file wher you had
> one key, but 20 or 30 columns of data?
> 
> do you do this:
> %stuff=(A => 'one', 'two', 'three'...etc?

Hash value must be a scalar, you will have to store the 
reference of the 20 or 30 element array.

my %stuff = (A => ['one', 'two',...]

perldoc perlreftut
perldoc perlref
 
> 
> And is it true that hashes are a lot quicker than
> arrays? if so, how much quicker? therefore if this is
> the case, hashes seem like a default "storage unit"
> over arrays, unless you have a relatively small array
> you need to search?

This really is a design issue, 
what is the layout of your data?
what kind of search mechanisms do you want to provide?

perldoc perldata
perldoc perldsc


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to