use 5.010; use strict; sub FOO () { 'foo' } BEGIN { undef &FOO } say defined &FOO ? 'subroutine defined' : 'subroutine undef'; say eval 'my $false; FOO if $false; 1' ? 'FOO allowed' : 'FOO not allowed' ; __END__ subroutine undef FOO allowed