Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Any way to call GetOptions with evaluated / interpoltated args ?

by Eily (Monsignor)
on Nov 26, 2018 at 16:16 UTC ( [id://1226357]=note: print w/replies, xml ) Need Help??


in reply to Any way to call GetOptions with evaluated / interpoltated args ?

It sounds like an unusual way of doing things, so maybe you should explain the broader context for your question, but to answer it you'll notice that in GetOptions( 'arg1=s' => \$arg1); there are no quotes around the second argument. You shouldn't have quotes in your other attempts (ie, instead of sending a string, send a reference):

my @opt = ('arg1=s', \$arg1); my %opt = ('arg1=s' => \$arg1);

Replies are listed 'Best First'.
Re^2: Any way to call GetOptions with evaluated / interpoltated args ?
by jjmoka (Beadle) on Nov 26, 2018 at 16:43 UTC
    Thank you very much. It works. Here my minor reason to want that. I also know I was entering an unusual field (I would even accept to relax sometimes the 'use strict "refs"' to use symbolic references). My command line script is expected to dump a 'usage' message (with the list of options) and a GetOptions to load them. For my personal taste I didn't like to replicate the same list in the 'usage' message and in GetOptions. I wanted a single list of options and then I'm using that list to both create the message and to feed GetOptions. Thanks again.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 06:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found