sub example { /foo/ and print "foo detected"; } catch \&example; catch sub { /foo/ and print "foo detected"; }; catch { /foo/ and print "foo detected"; }