http://qs1969.pair.com?node_id=515617


in reply to What one-liners do people actually use?

For the most part, I don't use one liners anymore; they typically cost me more time than they save.

For me, there are usually only two cases:

1) It's something I've done before -- in which case, it's nice to have it in a script, so that I can just type the name of the script, and worry less about typos or forgetting a step. Plus I can check the perldoc to find out what it does (when I write a script, I have a stronger incentive to write documentation than if I'm pulling a line out a command history).

2) It's something I've never done before -- in which case, it's nice to put it into a script, so that when I screw up the typing for the 11th time, I don't have to retype the whole thing. Sure, a decent command line can substitute, but it's still nicer to have a copy with the final version of what I've done, just in case I wonder in two weeks "how did I do that?", or worse yet, "What *exactly* did I *do*?".

That's just my experience; I used to like one liners, but in the longer term, I found the "time savings" by using them to be rather deceptive; I save more time in the long term by writing a clean script in the first place.

--
Ytrew