#!perl -w #=============================================================================== # # FILE: PerlWithOption.pl # # USAGE: ./PerlWithOption.pl # # DESCRIPTION: perl with option # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # AUTHOR: SUN JIA (), # COMPANY: # VERSION: 1.0 # CREATED: 2011-1-9 23:04:24 # REVISION: --- #=============================================================================== use warnings; use Getopt::Std; getopts('a:p:',/%args); if (defined $args{a}){ $a = $args{a}; } if (defined $args{p}){ $p = $args{p}; } if (!defined $args{a} or !defined $args{p}){ print "Usage: perl $0 -a <IP address> -p <Port>/n"; exit; } print "IP address: $a , Port: $p/n";