in reply to Using getopt

The problem is that $opt_i here is lexically scoped. Try use vars qw($opt_i); instead of my $opt_i;.

--
:wq