use strict; use Getopt::Long; my $Input_File=0; my $Ip_Range=0; GetOptions('InputFile|i=s' => \$Input_File 'Ip|I=s' => \$Ip_Range); if ($Input_File xor $Ip_Range) { # We have one or other of the input options given in the command line. } else { no valid input print usage. } #### script.pl i input.txt script.pl I 10.1.1.1-10.1.1.254 script.pl input.txt