How To Integrate Perl, Ruby, and Python Programs

Problem scenario
You want a Perl program to call a Python program to call a Ruby program to call another Python program.  You are using Linux as the OS.

Here is a one-line Perl program ( that calls a Python program:

system( "python /home/ec2-user/");

Here is a two-line Python program named  It invokes a Ruby program.

import subprocess['ruby /home/ec2-user/integration.rb'], shell=True)

Here is a one-line Ruby script file named integration.rb (that calls a Python script). 

exec( "python /home/ec2-user/" )

Here is a one-line Python program that prints a basic message, name it "":

print "This final Python script worked!!!"

If each of the above four programs (,, integration.rb, are all in the /home/ec2-user/ directory, just run the Python program like this:  perl

It will print "This final Python script worked!!!"  This demonstrates integration of three languages with four files and five lines of code. 

Leave a comment

Your email address will not be published. Required fields are marked *