next up previous contents
Next: Summary Up: Example uses of command-line Previous: Using the -i Option

Using the -s Option

The -s option lets you create your own custom switches. Custom switches are placed after the script name but before any filename arguments. Any custom switches are removed from the @ARGV array. Then a scalar variable is named after the switch is created and initialized to 1. For example, let's say that you want to use a switch called -useTR in a script like the one below:

if ($useTR) {

    # do TR processing.

    print "useTR=$useTR\n";


You might execute this program using this following command line:

perl -s -w -useTR

and it would display: