Posts

A Look at Finding Out-of-Date Files

On occasion, I need a script that will updates reports but only when the sources have changed. This is typically creating an XML file from log files or creating a static page for a web site. Here is a function to determine if the sources have changed after the last time the report was created.

A Look at Dumping

I used Data::Dumper a lot but it leaves something to be desired. By adding a function to MyUtils.pm , a simpler interface can be achieved.

A Place for the Tests

In a previous article , I created an empty module for some utilities. Now is the time to populate it...and to develop tests for the subroutines.

A Look at Conditional Compiling of Diagnostics

From time to time, I add diagnostic messages to be printed by my code so I can track what the program is doing. I often wondered if there was a way to get Perl to conditionally compile these statements and to get it to do so automatically. Here's how:

A Look At My Utility Library

Although there are many useful utility subroutines in Perl's standard modules, there are some that are missing. I'm going to spend the next few posts describing a few.

A Look at Cartesian Products

Copyright 2012 by Shawn H Corey. Some rights reserved. Licence under CC BY-SA 3.0 Problem: You have a number of sets and you want all the combinations when choosing one element from each set. In mathematics, these combinations are called the Cartesian product . They are also known as cross-products. In the database world, they are sometimes called cross-joins. This article is to show how to create them using Perl's glob function and how to create them in a subroutine.

A Look at Recursion

Copyright 2012 by Shawn H Corey. Some rights reserved. Licence under CC BY-SA 3.0 At first, recursion seems to be magic. Break the problem into smaller tasks, call the same subroutine to process those sub-tasks, and voilĂ , problem solved. In truth, it's not quite so simple but all recursion has four steps. Master those steps and you can do recursion with ease.