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

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]
[marto]: nice to see something like this on a standard home console

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2018-01-18 14:00 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (211 votes). Check out past polls.