sub primes { my($block) = @_; $block->(2); $block->(3); $block->(5); } my $code_ref = sub { my($p) = @_; print "A prime: $p\n"; }; primes($code_ref);