--On Tuesday, September 23, 2003 18:10 -0700 Trina Espinoza <[EMAIL PROTECTED]> wrote:
Hey Perl Peps,
I am stuck in the mudd and hoping someone can give me a few clues that will help get me back on track.
I want to submit some arguments like so: ./script1.pl -book -title HP3 -chapter 04
NOTE: -book does not have an argument Now I have been using GetOpt::Long and everything works except the first value -book. Since I want to treat -book like a boolean, I do not give it value, which causes problems because I guess it needs to receive some sort of value in it's current format. This is causing problems where the value of the second argument -title does not show. Is there a syntactical form I can follow to treat -book like a boolean and feed the other arguments values? Can I continue to use Getopt::Long?
Sure. There are two ways to do this, depending on whether you want '--nobook' to set 'book' to false or not. "book" by itself does the plain version: false if not present, true if present. "book=!" does false if not present, true if present and not followed by '--nobook'. (If nobook found afterward the book value will be set to false.)
Daniel T. Staal
--------------------------------------------------------------- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. ---------------------------------------------------------------
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]