#!/usr/bin/perl

use 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

???

$ perl -v

This is perl, v5.8.8 built for i386-linux-thread-multi

[...]

STF

=======================================================================
http://eisenbits.homelinux.net/~stf/ . My PGP key fingerprint is:
9D25 3D89 75F1 DF1D F434  25D7 E87F A1B9 B80F 8062
=======================================================================

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to