import perl
x = perl.eval('3+3')
print x
6
print type(x)
'int'
Neat, eh? Theoretically, you could paste any long string of perl code into the perl.eval() function and have it executed as perl. The return value is a perl object, with python attributes. Sounds strange, huh? Well, consider this code:
import perl
x = perl.eval('[12,23,34,45,{ foo=>999,bar=>666},56,67]')
print x
for i in x: print i
...
12
23
34
45
56
67
>>> print x[4]['foo']
999
Quite handy, non? You can also access perl modules using syntax such as:
import perl
perl.require('Digest::MD5')
You can download the rpm directly from my openSUSE build service repository.
Keine Kommentare:
Kommentar veröffentlichen