http://qs321.pair.com?node_id=1172204


in reply to Starting a New Script

How do I start a new perl script? Usually it happens when a one-liner grows too big (more than about five lines), or I find that I will want to run it again later. In that case, I copy the one-liner into a text file, and add some line breaks and other cleanups to make it more readable as it grows bigger.

Less often, I already know that I want to make a long re-usable script, in which case I just type something like

#!perl use warnings; use 5.014; print "hello, world,"; __END__
into a script, run it, then grow it from there.

In either case, I try to add code for the things it should do, one by one in order. I try to ensure that at each stage when I add a new part, I can run the script and get some sort of feedback diagnostic so I can see that it works. Eventually, I get a complete script I can run or modify.