{ 'foo' => 'bar', 'nose' => 'cuke', } #### use Safe; use strict; use warnings; use Data::Dumper; undef $/; my $string = ; my $compartment = Safe->new(); # $compartment->permit_only(qw(???)); # <-- my $hash_ref = $compartment->reval($string); die $@ if $@; print Dumper($hash_ref); __DATA__ # qx(); { 'foo' => 'bar', 'nose' => 'cuke', } __END__ 'quoted execution (``, qx)' trapped by operation mask at (eval 6) line 1, chunk 1. $VAR1 = { 'foo' => 'bar', 'nose' => 'cuke' }; #### $compartment->permit_only(qw(lineseq padany const leaveeval pushmark list anonhash)); #### karls-mac-mini:monks karl$ perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for darwin-2level karls-mac-mini:monks karl$ ./testomato.pl { 'foo' => 'bar', 'nose' => 'cuke', }; { foo => "bar", nose => "cuke" } karls-mac-mini:monks karl$ perlbrew use perl-5.17.7 karls-mac-mini:monks karl$ ./testomato.pl { 'foo' => 'bar', 'nose' => 'cuke', }; { foo => "bar", nose => "cuke" } karls-mac-mini:monks karl$ perlbrew use perl-5.18.0 karls-mac-mini:monks karl$ ./testomato.pl { 'foo' => 'bar', 'nose' => 'cuke', }; 'ref-to-glob cast' trapped by operation mask at (eval 5) line 1, chunk 1. undef karls-mac-mini:monks karl$ perlbrew use perl-5.18.1 karls-mac-mini:monks karl$ ./testomato.pl { 'foo' => 'bar', 'nose' => 'cuke', }; 'ref-to-glob cast' trapped by operation mask at (eval 5) line 1, chunk 1. undef