#!/usr/bin/perl -w # filename: test.pl Use Error qe(:try); try { &func1(); print "still in try block\n"; } catch Error::Simple with { my $err = shift; print "Error: ", $err->{'-text'}, "\n"; print "had some problem\n"; } otherwise { print "in otherwise block\n"; } sub func1 { print "in func1\n"; throw Error::Simple('throwing simple error'); }