in reply to perl child to return var to a bash parent

Read perlipc, basically, the only way parent/child process can communicate is through stdin/sdtout/stderr, so your bash program would read whatever your perl program prints to stdout, and do something with it

Since you already have perl, forget about writing bash, just write perl :)

  • Comment on Re: perl child to return var to a bash parent

Replies are listed 'Best First'.
Re^2: perl child to return var to a bash parent
by ddub7 (Initiate) on May 02, 2011 at 11:29 UTC

    Thanks for your reply :)

    Yes next time i'll go with perl but i spent so many days on the bash prog that it's too late for this one :(

    I was trying to avoid writing to a temp file, but finally it seems to be the less worst solution...

      I was trying to avoid writing to a temp file, but finally it seems to be the less worst solution...
      Why? Just call from your bash script:
      eval result=([1]=$(perl -e 'print join " ",map rand 10,1..50'))
      and then use the results:
      echo ${result[1]},${result[50]}
      No temp files needed.