I have not used Getopt for a long time but I think the answer to your problem
does not exactly lie with Perl ... it is probably more shell related ... if u
put yourself in the shoes of the shell interpreter and look at the commandline
u mentioned below then why would u think that tac and toe were not other
commands on a command line like
cat somefile | less
would you (remember you are the shell interpreter) think that the user is
asking you to cat the file 'somefile | less'?
Your shell woul have to be pretty clever to differentiate the context between
your example and mine(for example .. not the best one but I could not think up
somehing generic enough)
It does look like quoting it would be your best bets ... anyone else has any
ideas?
On Tue, Aug 21, 2001 at 08:12:13AM -0700, Salvador Lopez shaped the electrons to read:
> Using Getopt::Long, how can i pass a value that is a
> list into an scalar or array?
>
> In the following example, I would like 'tic tac toe'
> to be assigned to a scalar or array variable.
>
> ./perlscript.pl --arg1 foo --arg2 tic tac toe
>
> GetOptions( "arg1:s" => \$arg1, "arg2:s" => \$arg2);
> # $arg1 now contains "foo" (OK)
> # $arg2 now contains "tic" (Not OK)
>
> I would like $arg2, or possibly @arg2, to contain
> 'tic', 'tac', and 'toe'.
>
> Using quotes around the list works, but I would like
> to find a solution that doesn't use quotes if
> possible.
>
> thanks,
> sal
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]