eval { # parse call here }; if ($@ and $@ =~ /Ended early/) { # it's ok } elsif ($@) { die $@; }