Perl is well-known for its one-liners: short programs written as part of the command line invocation of the interpreter.
Certainly every programmer or sysadmin has the need, from time to time, to do a quick one-off task programmatically.
Such tasks can be done with a full script, to be sure, but once you get the hang of writing them, one-liners can save the time and hassle of actually doing so.
These tasks may include removing unwanted lines from files, collecting data from logs, or even a quick proof-of-concept of something that would become a script later.
They can read lines in files, even multiple files, can operate on files in-place, can read from STDIN as a pipe.
But while one-liners have been tools of the trade for these activities, certainly no such thing would be practical for web tasks, right?
But of course, on day 5 and day 6 of this series that we saw that we can build command line tools with your app.
We have even seen how to use the eval command to run a one-liner against your app.
So could we take this further?
Could we do remote data fetching and manipulation as a one-liner?
Could we build an entire web application as a one-liner?
Would I be asking if the answer was no?
Continue reading Day 23: One-Liners for Fun and Profit...