Calling Perl script from Ruby

Hi,

I have a Perl script that takes an input and outputs a string. I would
like to call this Perl script from my Ruby script and have the string
appear in my Ruby script after.

I was thinking I would use the command line of my system as the middle
man. Looking at Ruby’s Kernel#system it only returns true or false if
the command is found and ran successfully or not. I would like to get
that string instead of true if possible.

I am hoping to avoid complicated things like having the Perl write to a
file and then read that file into Ruby.

Any suggestions?

Thank you,
Peter

On Sun, Oct 22, 2006 at 02:50:14AM +0900, Peter M. wrote:

Hi,

I have a Perl script that takes an input and outputs a string. I would
like to call this Perl script from my Ruby script and have the string
appear in my Ruby script after.
[…]
Any suggestions?

Just do:

output = `perl myperlscript.pl arg1 arg2`

That should do the trick. You also have open3 and others, if you want
more
fine-grained control of input and outputs.

HTH,