in reply to Requiring option values in Getopt::Long

Getopt::Long will not exit for you; it will warn you (and the user) about the error, but it's up to you to exit if there was a problem.

Be sure to check the return value from GetOptions:

use Getopt::Long; my $option_test; my $result = GetOptions ( 'test=s' => \$option_test ); if (! $result) { die "Invalid option specifications"; }

Example:

$ ./getopt.pl -t Option test requires an argument Invalid option specifications at ./getopt.pl line 9. $