--- James Kelty <[EMAIL PROTECTED]> wrote:
> Below is a hash array...
> 
> %hash('james' => '1',
>       'kelty' => '2',
>       'brian' => '3');
> 
> This is my normal structure for a hash array, but I was wondering if it was
> possible to have multiple values for a key? I.e.
> 
> %hash('james' => '1',
>       'james' => '2',
>       'kelty' => '3',
>       'biran' => '4');

James,

You'll want to use array references or something similar:

%hash(  james => [ 1, 2 ],
        kelty => 3,
        biran => 4);

To access the extra values, you'll need to dereference them:

    print $hash{james}->[1]; #prints 2

See 'perldoc perlreftut' for a short tutorial on using references.

Cheers,
Curtis "Ovid" Poe

=====
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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

Reply via email to