eval { die new MyException("foo"); }; if (UNIVERSAL::isa($@, 'MyException') { print "Then my example worked!" }