in reply to passing parameters from shell script to perl program doesn't preserve spaces [solved]

This works, at least in bash:

$ args=(one "two three" four "five six") $ perl -e 'for (@ARGV) {print "$_\n"}' "${args[@]}" one two three four five six
  • Comment on Re: passing parameters from shell script to perl program doesn't preserve spaces
  • Download Code

Replies are listed 'Best First'.
Re^2: passing parameters from shell script to perl program doesn't preserve spaces
by peterbk (Initiate) on Dec 21, 2016 at 09:34 UTC
    Thanks @all for the hints.
    Parameter passing from shells seems to be not as easy as I had thought.
    Thus I have added another parameter to my perl program, which tells it to read the parameters from a file instead of the command line.
    This works like desired and circumvents shell interpretations.
      oh! if you admit to read params from files you can find Modules as configuration files an interesting solution.

      Mixing it with xargs made it easy.

      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.