Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Help display when executing the script

by Samy_rio (Vicar)
on Aug 08, 2006 at 10:22 UTC ( #566115=note: print w/replies, xml ) Need Help??

in reply to Help display when executing the script

Hi, If I understood your question correctly then try like this,

use strict; use warnings; use Win32; use Getopt::Std; my %opts; getopts("h", \%opts); help() if $opts{h}; sub help { Win32::MsgBox("Help Content", 32, "Help"); exit; }

Updated : Thanks davorg.

Velusamy R.

eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

Replies are listed 'Best First'.
Re^2: Help display when executing the script
by davorg (Chancellor) on Aug 08, 2006 at 10:32 UTC

    for a long time, Getopt::Std has supported an interface which doesn't require the use of package variables. You can pass in a reference to a hash and that hash will be populated with the options.

    use Getopt::Std; my %opts; getopts('h', \%opts); help() if $opts{h};

    I think that's a much nicer interface.

    Also, I think your call to getopts uses the Getopt::Long interface, not the Getopt::Std one. Getopt::Std only supports single letter options.


    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://566115]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2018-06-18 21:52 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.