On May 25, 1:30 ¨Âí¬ Òïâåòô Ëìåííå ¼óèïòôãõô®®®Àçïïçìåíáéì®ãïí¾ ÷òïôåº > 2009/5/25 Mohit Sindhwani <mo_m... / onghu.com>: > > > Jagadeesh wrote: > > >> Hi, > >> I am looking for something similar to join in perl. I am doing > >> [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(' ') > > Alternative approaches: > > str = "#{cmd} #{arg1} #{arg2} #{arg3}" > str = sprintf '%s %s %s %s', cmd, arg1, arg2, arg3 Robert, I love this approach. It makes my code more readable. Will use it. Thanks > > 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 > > Kind regards > > robert > > -- > remember.guy do |as, often| as.you_can - without endhttp://blog.rubybestpractices.com/