> > > my @content = ( hgapresidues=>'R', hgapresidues=>'N'
> , hgapresidues=>'D' )
> > > # each element of the array is a scalar
>[...]
> > I'm just surprised that, in perl, a hash may have several occurrences
> > the same key! :-)
Sorry, I gave a wrong explanation before.
my @content = (hgapresidues=>'R', hgapresidues=>'N' , hgapresidues=>'D');
is syntatic convenience.
my @content = ('hgapresidues', 'R', 'hgapresidues', 'N' , 'hgapresidues',
'D');
wll do the same, as
my @content = qw(hgapresidues R hgapresidues N hgapresidues D);
>It's an array, not a hash -- the '=>' operator is really just a synonym
>for ',' IIRC (though it's been a long time since I used Perl).
>
>I *think* @hash = {foo=>'a', bar=>'b'} would be a hash.
@ is what defines the array, not the right side of the assingment.
{foo=>'a', bar=>'b'} is a hash, of course.
@hash = {foo=>'a', bar=>'b'} makes position 0 of the array receive a
reference to this anonymous hash;
Then you can do
print $hash[0]->{foo}, "\n";
or
$hash[0]->{foo} = 'c';
print ${$hash[0]}{bar}, "\n";
will do too
Eduardo