Thank you! This is exactly what I need. The 17 pages in the PERLDOC lib info on Getopt::Long were a bit daunting/intimidating and for me like driving a nail with a shotgun.... This sample code gives me a really good example that shows the concept! Thank you for sharing it!
-----Original Message----- From: Miller, Joseph S [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 2:48 PM To: Copits Richard; [EMAIL PROTECTED] Subject: RE: How to use command-line switches... Richard here is an example of code that gets the switch variables from the command line and checks it before continuing with the script. The shift function is operating on the @_ array and the @_ array contains the parameters passed to that subroutine from the command line(reference perlvar). my $switch = shift; if($switch eq "" or $switch =~ /-u/i) { print "$usagestring"; exit 1; } elsif ($switch =~ /-p/i) { $portnum = shift; } elsif ($switch =~ /-d/i) { $dbalias = shift; } else { print "Invalid argument passed. Try again.\n$usagestring"; exit 1; } Hope it helps. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:04 PM To: [EMAIL PROTECTED] Subject: How to use command-line switches... I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of "if "/x" then..." ?? I've searched but can't seem to find any concrete example that a newbie like me can use as a sample. Thank you!! Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. Portions of this message may be confidential under an exemption to Ohio's public records law or under a legal privilege. If you have received this message in error or due to an unauthorized transmission or interception, please delete all copies from your system without disclosing, copying, or transmitting this message. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]