Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I now get#!/usr/bin/perl -w use strict; my $hash = {'MONTH' => 'January'}; print $hash->{MONTH} . "\n"; my $hashInitStr = "{'MONTH' => 'January'}"; # This would come from a f +ile my $hash1 = $hashInitStr; print $hash1->{MONTH} . "\n"
January Can't use string ("{'MONTH' => 'January'}") as a HASH ref while "stric +t refs" in use at ./anonHashfromStr.pl line 9.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Initializing an anonymous hash
by davies (Monsignor) on Mar 30, 2012 at 15:35 UTC | |
by Anonymous Monk on Mar 30, 2012 at 15:56 UTC | |
|
Re: Initializing an anonymous hash
by tobyink (Canon) on Mar 30, 2012 at 18:57 UTC | |
|
Re: Initializing an anonymous hash
by zentara (Cardinal) on Mar 30, 2012 at 18:19 UTC | |
by Anonymous Monk on Mar 31, 2012 at 07:45 UTC | |
|
Re: Initializing an anonymous hash
by Khen1950fx (Canon) on Mar 30, 2012 at 16:28 UTC | |
by Anonymous Monk on Mar 30, 2012 at 23:20 UTC | |
|
Re: Initializing an anonymous hash
by Marshall (Canon) on Mar 30, 2012 at 19:15 UTC | |
by Anonymous Monk on Mar 31, 2012 at 07:51 UTC | |
|
Re: Initializing an anonymous hash
by Anonymous Monk on Mar 30, 2012 at 15:44 UTC | |
by Anonymous Monk on Mar 30, 2012 at 16:05 UTC |