I had another idea regarding my little perl program which meant I learnt a little more. I thought it would be nice if the program could write the list of barcodes to a file as currently it sends them to the screen along with the final count. This meant I needed to learn how to use perl to create a file and write to it, from within the program. This turned out to be fairly easy as I’d already learnt some file handling last week in order to read data from a file.
I included checks to see whether a filename was passed as one of the arguments and if not to halt, with an indicative message. This version of the program will only successfully run if there are calls to a source CSV file and a text file is named for output. I s’pose the next step would be for it to generate a filename, based on the source file, if there is no output file included.
It had not been my intention to learn perl. I had planned to learn python but a task came up and I knew more about perl than python so I did it that way and it worked. I recall from my old computer engineering days that a good way to compare languages and learn their strengths and weaknesses, is to write the same program in each. I may give this a go when I’ve developed my barcode handler a little further.
Having registered for a course online with the hope that that would inspire me to learn, instead it’s more the case that I required a problem to solve in order to commit myself. Solving that problem in turn led to other possibilities to develop. I now have a few simple programs doing a couple of different actions on the same data and already I’m thinking that later, I should turn them into one program that does all that and more. At some point along the way, it would be good to develop a web interface and make it easier for other people to run the same reports.
Early days but clearly, I am having fun :-)