179

Subroutine Prototypes
Subroutine Prototypes

  • You may declare subroutines with an optional prototype definition

  • Prototypes constrain subroutine caller's arguments to match in number and type to a pre-specified definition

      sub MySubroutine($\@$) { EXPR }

  • Only calls using the "new" style of subroutine call syntax are checked

  • New style calls reference subroutines without the & prefix

      MySubroutine( "Hello", @foo, 12.32 );