use strict; use warnings; use Getopt::Long; Getopt::Long::Configure('prefix=+'); my %opt; GetOptions(\%opt, qw(help offset=i)) or die "error...\n"; $opt{offset} = 3 unless exists $opt{offset}; my $value = shift; print ' result = ', $value + $opt{offset}, "\n"; #### $ add.pl 5 result = 8 $ add.pl -5 result = -2 $ add.pl +offset -2 12 result = 10