my $text = read_some_file_or_else(); eval $text; if ($@) { print "Error in eval: $@"; }