Chapter 38. Using Other Languages from Perl

Brian Ingerson

Inline is a Perl module that allows you to use other programming languages from within Perl code. Initially, I created it to use C from within my Perl programs, and thanks to the efforts of a number of developers, it can now handle not just C but awk, BASIC, C++, Java, Python, Ruby, Tcl, and even assembly language.

I started out as an IBM assembly language programmer: hexadecimal arithmetic, bit-level operations, debugging 500 page core dumps printed on greenbar paper, and so on. The cool thing about assembly language is that you can do anything. You could write a nice menu-based hyperlinking user interface that stores its data on your own homemade mass-storage device. What sucks about assembly language is that you have to do everything. Programming A = B + C takes more than one punch card.

After a while, I spent most of my time developing programming tools and language extensions. Any hacker worth his salt can’t code something the same way more than three times without writing an abstraction to eliminate the repetition. I wrote things to turn concepts like memory allocation, I/O, and database access into assembly language one-liners with a touch of object-oriented behavior.

When I switched to Perl around 1997, it was a natural transition. I found I could do everything I needed, with a lot less work. Perl has many powerful built-in features and extensions: regular expressions, runtime evaluation, LWP, and CGI, to name a few. ...

Get Computer Science & Perl Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.