Chas Owens wrote:
Note that my advice is to use

$hash3{"@key"}

Which does not suffer from that problem and that I specifically said
"you don't want the spaces that using an array slice will add".



Whnever you use a composite key, you have the possibility of a collision.

#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;

my %hash1 = ();
my %hash2 = ();

my @key1 = ( 'a b', 'c' );
my @key2 = ( 'a', 'b c' );

$hash1{"@key1"} = 'some value';
$hash1{"@key2"} = 'some other value';

$hash2{$key1[0]}{$key1[1]} = 'some value';
$hash2{$key2[0]}{$key2[1]} = 'some other value';

print "\%hash1 = ", Dumper \%hash1;
print "\%hash2 = ", Dumper \%hash2;

__END__


--
Just my 0.00000002 million dollars worth,
 Shawn

"For the things we have to learn before we can do them, we learn by doing them."
 Aristotle

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


Reply via email to