Call perl program from C - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Call perl program from C

I've been trying to call a perl program (an entire program not just a subroutine)and I really don't want to use call() or any exec() functions as I'd like to not have to initialize the perl interpreter each time this program is called.

I've looked at the perlembed stuff but all I can find is ways to call subs or functions not entire programs.

Can anyone help with a link to some sample code? or some suggestions with where to start?

Thank you in advance.


  • gustavo-serragustavo-serra Posts: 21Member
    Well, this post is rather old. I am returning to Programmers Heaven, so I just saw it.

    Ok, my sugesstion is that you could create two pipe files. You would perform this outside from your program. You can see how [link=]here[/link].

    Then, you will start the execution of your Perl script and instruct it to read/write from/to the pipes that you created. In your C program, you will open both pipes too. Then, all the communication between the perl script and C executable will happen through the pipes. You need to start the perl script only once (I don't know how the script or, to tell the truth, how Perl works).

    Hope it helps!
Sign In or Register to comment.