Hi,

Am Montag, 25. Mai 2009, 17:30:43 +0900 schrieb Robert Klemme:
> 2009/5/25 Mohit Sindhwani <mo_mail / onghu.com>:
> > Jagadeesh wrote:
> >> [sample perl code]
> >> $CMD = join(' , cmd, $arg1, $arg2, $arg3);
> >>
> > Not 100% sure of what you need, but I think this will do the job for you:
> > str = [cmd, arg1, arg2, arg3].join(' ')
> 
> If this is for executing an external process, there is no need to lump
> all these together, instead you can do which has the advantage that
> you do not need a shell to parse the individual arguments and also
> whitespace cannot cause trouble.
> 
> system cmd, arg1, arg2, arg3

There are two more advantages: Arguments that contain spaces
remain one argument. Arguments that contain shell operators like
; && || `...` could produce malicious side effects.

Another approach:

  args = [ arg1, arg2, arg3]
  system cmd, *args

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de