- or download this
sub try (&$) {
my($try, $catch) = @_;
...
}
sub catch (&) { $_[0] }
- or download this
try {
die "phooey";
...
catch {
/phooey/ and print "unphhoey\n";
}
- or download this
sub identity {
return $_[0];
}
- or download this
sub example {
/foo/ and print "foo detected";
...
catch {
/foo/ and print "foo detected";
}
- or download this
try {
# some code that dies
...
catch {
# pattern match against $_ for die string
}
- or download this
try( sub{
# code that dies
...
}
)
);