in reply to Initializing an anonymous hash

I tested it using eval as suggested by davies and Anonymous Monk's do:
!/usr/bin/perl -l use strictures 1; use Devel::SimpleTrace; BEGIN { use strict 'refs'; use warnings; eval { do { my $hash = {MONTH => 'January'}; print $$hash{'MONTH'}; } } } BEGIN { use strict 'refs'; use warnings; eval { do { my $hashInitStr = {'MONTH' => 'January'}; my $hash1 = $hashInitStr; print $$hash1{'MONTH'}; } } }

Replies are listed 'Best First'.
Re^2: Initializing an anonymous hash
by Anonymous Monk on Mar 30, 2012 at 23:20 UTC

    I tested it using eval as suggested by davies and Anonymous Monk's do:

    Nope