gube has asked for the wisdom of the Perl Monks concerning the following question:
There are two code snippets pasted below for pragma constant. First program works fine. And second seems not working. Pour your Ideas.
First Program below :
#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; my %hash = ( 'a' => 2 ); use constant A => \%hash; print A->{a};
Second Program below :
#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper; my $hash = { 'a' => 2 }; use constant A => $hash; print A->{a};
Gubs
Nice to Breathe with Perl :-) Just try
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Doubt in assigning hash reference values for Constant pragma declaration ?
by salva (Canon) on Sep 21, 2007 at 07:08 UTC | |
by gube (Parson) on Sep 21, 2007 at 10:08 UTC | |
Re: Doubt in assigning hash reference values for Constant pragma declaration ?
by Anonymous Monk on Sep 21, 2007 at 07:03 UTC | |
by chromatic (Archbishop) on Sep 21, 2007 at 08:48 UTC |
Back to
Seekers of Perl Wisdom