How to call an external command with the elements of a list as parameters? 
Author Message
 How to call an external command with the elements of a list as parameters?

Hi,

I'm trying to call an external command with the element of a list as
parameters; however, the command receives the entire list as one
argument.

Here's what I've tried:

   set foo {one two three}

Instead of three arguments, Perl only receives one argument, "one two
three".

I've tried fooling around a bit with list and concat and eval but that
didn't seem to help.

What must I do to "open up" the list and give Perl three arguments?

Wait -- I just managed to do it with the following:


But that looks more than ugly ;) (especially the eval and the double
{{ }} around the Perl script, since one level of braces is removed by
concat, and the second level is required by exec to make the Perl
script be one argument).

Isn't there a better way?

Cheers,
Philip
--

If you're not part of the solution, you're part of the precipitate



Sun, 06 Apr 2003 03:00:00 GMT  
 How to call an external command with the elements of a list as parameters?

Quote:
> ...
> What must I do to "open up" the list and give Perl three arguments?

> Wait -- I just managed to do it with the following:


> But that looks more than ugly ;) (especially the eval and the double
> {{ }} around the Perl script, since one level of braces is removed by
> concat, and the second level is required by exec to make the Perl
> script be one argument).

> Isn't there a better way?

I _think_ you can simplify this to:


                                            Chris
--
Rens-se-LEER is a county.  RENS-se-ler is a city.  R-P-I is a school!



Sun, 06 Apr 2003 03:00:00 GMT  
 How to call an external command with the elements of a list as parameters?

...

Quote:
> Wait -- I just managed to do it with the following:


> But that looks more than ugly ;) (especially the eval and the double
> {{ }} around the Perl script, since one level of braces is removed by
> concat, and the second level is required by exec to make the Perl
> script be one argument).

> Isn't there a better way?

Don't use "concat" ?


--
Pascal



Sun, 06 Apr 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. External Call with variable parameter list

2. HELP: External command (Subcommand) handler to update REXX parameters

3. Neophyte: How to call external .cmd files w/parameters

4. Add a new element in a tcl list through a C command

5. str(list) calls repr() on elements?

6. Ada 0y wish list: parameters of package parameters

7. confused about adding elements to a list with list.append(otherlist)

8. Deleting list of elements from a list

9. common elements in list of list

10. list -> elements of list

11. Turning a list value in a parameter into a list for eval without quasiquote/unquote

12. Passing an array element as a parameter

 

 
Powered by phpBB® Forum Software