in reply to Using hashref values in constant declarations.
use strict; use warnings; use Data::Dumper; use constant HASHREFCONST => do { my $hashref = { 'ONE' => 1, 'TWO' => 2, 'THREE' => 3, 'FOUR' => 4, }; [$hashref->{ONE} .. $hashref->{FOUR}] }; print Dumper(HASHREFCONST);
$VAR1 = [ 1, 2, 3, 4 ];
Depends what your real intention is...
for instance the use of a range .. looks very dubious!
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
|
|---|