in reply to Re^2: perl5 "prototyping": why?
in thread perl5 "prototyping": why?
Any backslashed prototype character represents an actual argument that absolutely must start with that character. The value passed as part of @_ will be a reference to the actual argument given in the subroutine call, obtained by applying \ to that argument.So you call foo as foo($a_scalar, @an_array, %a_hash) and you will get automatic reference/dereference magic.
Dropping the backslash however breaks this behaviour:
Unbackslashed prototype characters have special meanings. Any unbackslashed @ or % eats all remaining arguments, and forces list context. An argument represented by $ forces scalar context.
@baz would then indeed gobble up the hash following it.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
|
|---|