use strict; use Getopt::Long; my $len = 0; my %h = ('length' => \$len); GetOptions (\%h, 'length=i'); print "$len\n"