Subroutines
Defining Subroutines
  • You can reuse a segment of Perl code by placing it within a subroutine
  • The subroutine is defined using the sub keyword and a name
  • The subroutine body is defined by placing code statements within the { } code block symbols

sub MySubroutine
{
# Your Perl code goes here.
}

      &MySubroutine();       &MySubroutine();

      &MySubroutine( $a , $b);