in reply to make subroutine that takes expression as implicit block as first arg

> The block part is easy; but is it possible to make it do the expression part?

no, unfortunately there's no prototype mechanism for the latter.

You can neither easily allow calling a function (which is a special case of the expression part).

There was a discussion about this a year ago, I will update a link.

UPDATE:

see coderefs and (&) prototypes and The & prototype and code references in scalars..

Cheers Rolf

  • Comment on Re: make subroutine that takes expression as implicit block as first arg