use Getopt::Long; my $option_test; my $result = GetOptions ( 'test=s' => \$option_test ); if (! $result) { die "Invalid option specifications"; } #### $ ./getopt.pl -t Option test requires an argument Invalid option specifications at ./getopt.pl line 9. $