package Aa; use warnings; #no warnings 'void'; use strict; #no strict 'refs'; package Bb; #>> when you uncomment this, it wont work!! #use strict; #use warnings; #<< my $strict = eval('package Aa;my $h;BEGIN { $h = ${^H} };return $h;'); printf "use strict " . ($strict == 1794 ? 'yes' : 'no') . "\n"; my $warn = eval('package Aa;my $w;BEGIN { $w = ${^WARNING_BITS} };return $w;'); printf "use warnings " . (unpack('b*', warnings::bits('all')) == unpack('b*', $warn) ? 'yes' : 'no') . "\n";