in reply to How do I pass a block like map/grep/sort/etc?

Is there anyway to make your own function that can take a block of code

In short, yes. perldoc perlsub, read about prototypes.

  • Comment on Re: How do I pass a block like map/grep/sort/etc?

Replies are listed 'Best First'.
Re: Re: How do I pass a block like map/grep/sort/etc?
by Anonymous Monk on Mar 06, 2004 at 02:26 UTC
    Sweet, I didn't know about '&', I couldn't find it when I was looking for prototypes earlier. How do these functions get away with being unprototyped though (i.e. print prototype "grep"; prints nothing).

      Quoth perldoc -f prototype:

      If the builtin is not overridable (such as "qw//") or its arguments cannot be expressed by a prototype (such as "system") returns "undef" because the builtin does not really behave like a Perl function.
      err I mean "CORE::grep".