sub checkSomething { 0 } sub testBlock (**&) { my ($block,$cond,$sub) = @_; my $test = &{$cond}; $test ? &$sub : warn "not running code for $block since '$cond' failed \n"; } testBlock "Block1", 'checkSomething', sub { print "done\n"; # or another test };