use 5.010; sub ok { # remove the "use strict;" and try again... use strict; local $@; eval { $_[0]->[0]; 1 }; } say ok('foo');