my $param = Sub::ParamObject->new({ foo => qr/\d+/, bar => sub { $_[0]->{foo} > 3 && $_[1] =~ /^this|that$/ } }); $param ->foo(7) ->bar('this'); # succeeds $param ->foo(2) ->bar('this'); # fails