in reply to Bare BLOCK vrs. grep BLOCK

Hi, may be I am asking a dumb question, but why do you have (&@) in sub mygrep (&@) ? Shouldn't it just be sub mygrep { your greplike function code}?

Replies are listed 'Best First'.
Re^2: Bare BLOCK vrs. grep BLOCK
by mr_mischief (Monsignor) on Jan 15, 2018 at 21:34 UTC

    In perlsub subroutine prototypes are discussed. They are seldom needed, but a grep-like subroutine is one of the examples, and is shown using &@ as a prototype. This means to expect a subroutine and then a list.