in reply to How to access Python member functions from perl
... you need a script like this ...$ cat fibo.py # Fibonacci numbers module # My Python module def fib(n): # write Fibonacci series up to n a, b = 0, 1 while b < n: print b, a, b = b, a+b def fib2(n): # return Fibonacci series up to n result = [] a, b = 0, 1 while b < n: result.append(b) a, b = b, a+b return result
... and here's a Perl wrapper ...$ cat runfib.py #!/usr/bin/python import fibo fibo.fib(1000) print "\n" print fibo.fib2(100)
... see this works like so ...$ cat runfib.pl #!/usr/bin/perl print `./runfib.py`;
$ ./runfib.pl 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to access Python member functions from perl
by Rahul6990 (Beadle) on Jan 30, 2013 at 07:11 UTC | |
|
Re^2: How to access Python member functions from perl
by PerlRider (Initiate) on Jan 30, 2013 at 07:13 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |