El Aug 3, 2007, a las 1:45 PM, Mr. Shawn H. Corey escribió:

But the expression $hash{"@cdr[2,3,6,7]"} is the same as $hash{join ($",@cdr[2,3,6,7])} You have just replaced one special variable with another and $" is a bad choice since it's default is a space character, which may easily appear in one (or all) of @cdr[2,3,6,7]

A better choice is $hash{$cdr[2]}{$cdr[3]}{$cdr[6]}{$cdr[7]} but you would need four for-loops to get to the value.

To be able to use arrays as keys there are a couple of modules out there. One is mine, based on pack/unpack :

  http://search.cpan.org/~fxn/Hash-MultiKey-0.06/MultiKey.pm

and there's another one that is implemented as nested hashes, but I can't remember its name right now, does anybody know it?

-- fxn


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to