#!/usr/bin/perl use warnings; use strict; use Getopt::Long; my ($option_test); GetOptions( "test=s" => \$option_test ); print 'option is not defined.' if ( ! $option_test ); #### $ test.pl option is not defined. $ test.pl -t Option test requires an argument option is not defined.