Processing command line 
Author Message
 Processing command line

Hi all,

I'm using GetOpt::Long and want to parse a command switch like:

Quote:
>script.pl --host host_1 host_2 host_3 host_n


really need a way to know that they were passed with the --host switch.

Any ideas on how to do this? Keep in mind that the host names can be just
about anything and are not limited to the host_n format I illustrated above.

Thanks,
Larry S.



Tue, 16 Dec 2003 05:17:47 GMT  
 Processing command line

Quote:

> Hi all,

> I'm using GetOpt::Long and want to parse a command switch like:
>>script.pl --host host_1 host_2 host_3 host_n


> but I really need a way to know that they were passed with the
> --host switch.

> Any ideas on how to do this? Keep in mind that the host names can be
> just about anything and are not limited to the host_n format I
> illustrated above.

From "perldoc Getopt::Long":

       Options with multiple values

       Options sometimes take several values. For example, a
       program could use multiple directories to search for
       library files:

           --library lib/stdlib --library lib/extlib
...


way to indicate the end of the list in your desired syntax?  In fact,


is a list of something else.

--
Ren Maddox



Tue, 16 Dec 2003 06:31:01 GMT  
 Processing command line

Quote:

> Hi all,

> I'm using GetOpt::Long and want to parse a command switch like:
> >script.pl --host host_1 host_2 host_3 host_n


> I really need a way to know that they were passed with the --host
> switch.

> Any ideas on how to do this? Keep in mind that the host names can be
> just about anything and are not limited to the host_n format I
> illustrated above.

Type the commandline as:
        script.pl --host host_1,host_2,host_3,host_n
And then split on commas.

--
The longer a man is wrong, the surer he is that he's right.



Tue, 16 Dec 2003 11:49:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Processing command line.

2. ANNOUNCE: Getopt::Long 2.9 -- Universal command line options processing

3. HELP: Command line processing

4. patch1 for wafeperl 0.2 to allow xt command line argument processing

5. ANNOUNCE: Getopt::Long 2.6 -- Universal command line options processing

6. Perl command line processing, Windows/dos style ?

7. HELP: Command line processing

8. basic query about command line processing in Perl

9. ANNOUNCE: Getopt::Long 2.9 -- Universal command line options processing

10. ANNOUNCE: Getopt::Long 2.6 -- Universal command line options processing

11. command line processing

12. Simple I/O to a command-line process?

 

 
Powered by phpBB® Forum Software