in reply to Text File Section Extractor

An alternative to your state variable technique is to use Perl's Range Operators.

A standard way to process command-line arguments is to use the core module Getopt::Long. And since you offer all these options, a standard way to describe them is to use the core module Pod::Usage.

When you're ready to start using modules, the Monastery offers some great reading on the topic:

Tutorials -> Creating and Distributing Modules -> Simple Module Tutorial

Enjoy.