View Single Post
  #1 (permalink)  
Old 03-11-2007, 03:00 AM
Dave Slayton
 
Posts: n/a
Default why doesn't this argument list need a comma after the 1st argument?

Sorry, another newbie question:

I'm reading this very interesting book on Perl (Effective Perl Programming
by Joseph N. Hall with Randal L. Schwartz), and here on page 110 there's an
example of a
call to a (prototyped) subroutine that requires 3 arguments: a coderef, a
scalar, and an array, and here's the call:

for_n {print "$_[0], $_[1]\n"} 2, @a;

I understand the parentheses around the list of arguments are optional, and
that the anonymous subroutine does not require the "sub" keyword, but what I
don't understand is how the call gets away with not having a comma after the
closing curly brace and before the 2. Can anyone shed some light on this
for me?


Reply With Quote