in reply to Using getopt

Using the two-argument form of 'getopt' (passing a hash reference) allows you to avoid the global variable:
use Getopt::Std; use strict; my %opt; getopt('i', \%opt); print "Increment value is $opt{i}\n";
I also prefer to use 'getopts' over 'getopt' since it requires you to list all valid options, and specify whether each option takes an argument (such as your increment value).

Impossible Robot