in reply to Hash values and constants
adding a '&' or () to the constants name, will be enough of a hint to give you the desired results.
Outputs:#!/usr/local/bin/perl -w use strict; use Data::Dumper; use constant TESTVALUE1 => 1; use constant TESTVALUE2 => 2; use constant TESTVALUE3 => 3; my %hash; $hash{ TESTVALUE1 } = 'OK'; $hash{ &TESTVALUE2 } = 'OK'; $hash{ TESTVALUE3() } = 'OK'; print Dumper( \%hash );
:!./test.pl $VAR1 = { '2' => 'OK', 'TESTVALUE1' => 'OK', '3' => 'OK' };
Wonko
|
---|