On May 30, Paul said:
>Just an elaboration -- you can do this:
>
> @hash{ qw( a b c ) } = qw( 1 2 3 );
>
>which should give you the same as:
>
> %hash = ( a => 1, b => 2, c => 3 );
Only if %hash was previously empty. Assigning to a hash all at once
clears it and sets the key-value pairs you prescribe:
%hash = ( a => 1, b => 2, c => 3 );
Assigning to a hash slice sets only the key-value pairs for those keys:
@hash{qw( d e f )} = (4..6);
# %hash is now ( a, 1, b, 2, c, 3, d, 4, e, 5, f, 6 )
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** I need a publisher for my book "Learning Perl's Regular Expressions" **