laziness, impatience, and hubris | |
PerlMonks |
Re: Resource for command line "one-liner" interpretationby hv (Prior) |
on May 15, 2003 at 02:02 UTC ( [id://258309]=note: print w/replies, xml ) | Need Help?? |
The main thing to look at is perlrun, which will describe the command-line options to perl - understanding what options are available, and how they interact with each other, is crucial to writing and understanding one-liners. Beyond that, it is just perl. One-liners tend to take shortcuts that make the perl less obvious to someone more used to application code - no strictures, heavy use of special variables (perlvar) and nasty tricks that would be more trouble than they're worth in a production/maintenance environment. Another important aspect to grok is the Unix philosophy beyond perl - lots of tools that do (mostly) simple things and work well together. For example, this is an invocation I use remarkably often: The power of perl knowledge is that you can add to this set - look out for things that you do regularly, and try to write tools to add to the set to reduce the amount of typing and, more importantly, thinking required to do your day to day tasks. And when you write such tools, treat them as applications rather than one-liners - perl is all about having the kitchen sink as well. Taking it out of context, this article includes some short examples of the sort of utilities I'm talking about. But there's no reason your utilities need to be short - one of my most often used self-written utilities is 818 lines (including POD) and supports 19 distinct command-line options in around 25920 combinations. Hugo
In Section
Seekers of Perl Wisdom
|
|