Stanisław T. Findeisen wrote:
#!/usr/bin/perluse warnings; use strict; use constant { SOME_CONSTANT => 'some value' }; my $index = 'some value'; my %hash = (); $hash{SOME_CONSTANT} = 'value 1'; $hash{$index} = 'value 2';print("The value is: " . $hash{SOME_CONSTANT} . '/' . $hash{$index} . "\n");print("Comparison 1: " . (SOME_CONSTANT eq $index) . "\n"); print("Comparison 2: " . ($hash{SOME_CONSTANT} ne $hash{$index}) . "\n"); $ perl ./hash-test.pl The value is: value 1/value 2 Comparison 1: 1 Comparison 2: 1 ???
So, what behavior exactly is it that you consider weird? What output had you expected?
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
