180

Subroutine Prototypes
Prototype Definitions

  • Perl uses its variable dereferencing symbols as prototype parameter definition tags

      Symbol Declares
      $ A scalar argument
      @ A list argument
      & A subroutine argument
      \$ A scalar reference argument
      \@ A list reference argument
      \% A hash reference argument

  • Specifying multiple tags declares additional arguments

      sub MySubroutine2($$\@$) { EXPR }
      # Takes two scalars, a list reference, and a third scalar