fREWdiculous!
3 Mar
Jeff Atwood claims that comments are a required ingredient for a blog. How true! There have been some comments recently on my original post about an interactive perl shell. My post mostly centered around writing one liners with your regular shell.
Well, brunov replied and mentioned Devel::REPL, which is excellent! It has all kinds of great features and really does everything that you would expect a modern language shell to do. It’s a surprising hassle to get to work with ActiveState perl in windows, but in Linux it works like a charm!
G briefly mentioned perl -de0, which is alright, if you want something out of the box, but if given a choice between perl -de0 and perl -E, I’d choose the latter, as at the very least I get the latest 5.10 features that way. Unless I missed something you can’t even do things on multiple lines in perl -de0. But I’m sure plenty of people dig it.
Anyway, hope that helps someone!
17 Jan
Ok, so irb is totally great for testing out some syntax and general sanity checking, but we don’t really have that with perl…or do we?
I am sure that all of the real perl hackers out there know this, but the best perl shell is your real shell. If I wanna do some cool stuff with perl I can do a lot of it directly from my shell with -e (I recommend -E as you can use ‘say’, which is helpful so that you can avoid quote issues.)
Anyway, since my brain has been so affected by ruby functional programming I have been doing a lot of:
1 | perl -Mautobox::Core -E '@f = (<*.foo>); @f->foreach(sub { ... })' |
So I am making an alias like this:
1 | alias ipl='perl -Mautobox::Core -E' |
Every little keystroke matters in such a case
Anyway, hope this helps at least remind you of the power you already have.