Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: embed python script into perl script?

by Arunbear (Parson)
on Jan 23, 2012 at 18:17 UTC ( #949480=note: print w/replies, xml ) Need Help??

in reply to embed python script into perl script?

It is possible, though it seems like a false economy. Here is another method:
#!/usr/bin/perl use autodie; use strict; use warnings; my $code = do { local $/; <DATA> }; my $result = qx/python -c '$code'/; print "$result\n"; __DATA__ def cube(x): return x * x * x print "the cube of 2 is %d" % cube(2)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://949480]
[LanX]: it's up to the Supreme commander
[GotToBTru]: we don't have one of those ;)
[LanX]: commander in chief whatever
Discipulus fears to ears this in German..
[LanX]: missing for month

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2017-01-20 12:46 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (174 votes). Check out past polls.