Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: getopt::std help

by davidrw (Prior)
on Jan 07, 2008 at 02:45 UTC ( #660735=note: print w/ replies, xml ) Need Help??


in reply to getopt::std help

Add this to see what's going on:

use Data::Dumper; print Dumper $o;
And you'll see that the key 'h' _is_ being created, and the value is undef, which is why your if statements don't pick it up, since it's a false value. This will do what you want:
usage() if exists $o->{h};


Comment on Re: getopt::std help
Select or Download Code
Re^2: getopt::std help
by convenientstore (Pilgrim) on Jan 07, 2008 at 02:57 UTC
    doh..
    Thank you.
    One more thing, will using getopt automatically reject the flags that are not explicitly specified (getopt('hltf', $o);), meaning if I call a program w/ ./program -x ,
    Will getopt automatically reject and abort the program or do I need to tell the program that?

      Try running ./program -x and see what happens. Sometimes the best way to learn is to experiment;)

        just to follow up on my post and also just in case there are newbies on this site like me who is having trouble deciphering other official document on getopt::Long,

        I ran into below page which gave me enough examples and definition for my slow head to understand bit better.. just wanted to share
        But I thank all the experts who reply to my posts as always :-) as there is nothing like coming here and get help/advice/encouragement(sometimes kick in the ass) to continue my journey of perl.. I love perl!!!!

        http://world.std.com/~swmcd/steven/perl/pm/getopt.html

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://660735]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2014-07-24 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls