On Mon Dec 01 2008 @  7:13, blake askew wrote:
> Thanks for the help John. I have made the changes you suggested and managed
> to get everything working properly. One more question though that is
> completely different, how do I allow users to specify switches on the
> command line in any order to be used in my program. For example, I want the
> syntax to be ./ipcheck.pl <ip> <port> {options specified in any order}. I
> know I can get the value for the ip using $ip=$ARGV[0] and port using
> $port=$ARGV[1] but how would I get the remaining options?
> 
> Example to help clarify: ./ipcheck 10.10.10.1 80 -n -a  -r
> where -n -a -r are options in no particular order, 10.10.10.1 is the ip and
> 80 is the port.

Check out Getopt::Long. It's a core module (that is, it's available with
Perl itself - you don't need to install anything extra).

perldoc Getopt::Long

Hope this helps, T

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to