Wednesday, June 23, 2010

how to do ipython in perl...

I've been writing a lot of python code lately and I really enjoy having that instant trial and error you can get by using an interactive code shell. (IPython and a half dozen other tools allow this).

I had to switch to perl on a project and went looking for a similar tool. I wasn't able to find much out there but I did stumble on a quick solution.

perl -ne 'eval $_ ; print ">> "'


This will loop over all input from standard in and attempt to evaluate it. The only downside is you won't be able to write anything that takes multiple lines (for, while, try, or functions). But it is a lot easier than writing perl oneliners over and over again to test out theories.

No comments: