use strict; use Test::More tests => 12; sub second_eval_unaffected($) { my ($code) = @_; eval $code; diag $@ if $@; my $string = ''; ok eval(q($string="new eval done";)), "Eval after >>$code<< still works"; is $@, '', "... and raises no error either."; is $string, 'new eval done', "... and sets the variable correctly"; }; second_eval_unaffected 'my $var_without_accent;'; second_eval_unaffected 'my $var_with = "é_accent";'; second_eval_unaffected 'my statement_with_error;'; second_eval_unaffected 'my $var_with_é_accent";';