eval { # code here that might throw exceptions # this is the form that you described } #### my $string = '4 + 5'; my $answer = eval $string;