1

I'm writing a perl script that needs to be share with a C++ program(which is already written). And i am very poor at writing C++ programs.

Could anyone suggest me how to incorporate a C++ program into a perl script? and give the input from the perl script to the C++ program?

Pari.
  • 27
  • 1
  • 7
  • If the C++ program is already written, why does it matter that you're poor at writing C++? You only need your *Perl* skills for this. – Kerrek SB Jul 23 '12 at 05:23
  • that is a open script .. ya i wanted to know how to incorporate C++ in perl? – Pari. Jul 23 '12 at 05:50

3 Answers3

3

You can execute a external script from perl using

  1. Backticks operator
  2. system function
  3. exec function
  4. Pipe
Jithin
  • 2,594
  • 1
  • 22
  • 42
2

Have a look at Inline::CPP - Write Perl subroutines and classes in C++.

Nikhil Jain
  • 8,232
  • 2
  • 25
  • 47
1

There is SWIG with which you can provide classes from your C++ program that you want to share with Perl. You can configure which classes you want to share in some object file.

daxim
  • 39,270
  • 4
  • 65
  • 132
Verena Haunschmid
  • 1,252
  • 15
  • 40