... the script still does nothing.
[root@wsprod01 myperl]# ./test.pl --domain google.com --client google
Usage: ./test.pl --domain companydomain.com --client company [--job-co
+de 12345] [--help].
In the code shown in the OP, in the statement
GetOptions (
'domain=s' => \$domain,
'client=s' => \$client,
'job-code:i' => \$job_code,
'help' => &usage()
) or &usage();
the 'help' key is given the value of whatever is returned by a call to the usage() function. Problem is, this function returns nothing; rather, it calls die to print a usage message, so program execution will never get past the GetOptions() function call. Is this what you intend?
Updates:
- If you want to assign the 'help' key a reference to the usage() function,
'help' => \&usage,
would be the correct expression.
- Added italic emphasis in "... a call to the usage() function."
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|