# to raise an exception (simply): Exception->raise('text'); # to trap exceptions 'foo', /bar/, or 'baz': my $err=new Exception 'baz'; try { something_that_could_raise_an_exception(); } when ['foo', qr/bar/, $err], except { shift->croak; };