10. Subroutines

Introduction

Accessing Subroutine Arguments

Making Variables Private to a Function

Creating Persistent Private Variables

Determining Current Function Name

Passing Arrays and Hashes by Reference

Detecting Return Context

Passing by Named Parameter

Skipping Selected Return Values

Returning More Than One Array or Hash

Returning Failure

Prototyping Functions

Handling Exceptions

Saving Global Values

Redefining a Function

Trapping Undefined Function Calls with AUTOLOAD

Nesting Subroutines

Program: Sorting Your Mail