Subroutines
Returning Values

  • There is no difference between a subroutine and function in Perl

  • Values are returned from a subroutine using the return(); function

  • Single return value
      sub MySubroutine
      {
      	return( $myScalar );
      	return( "Hello" );
      }
      
  • Multiple return values

      return( "Hello", $myScalar );
      return( @myList );
      return( %myHash );