Google turned up some PM nodes on cellular automata, like An attempt at maze solution with Cellular Automata. However, rather than rolling your own in Perl you might save yourself a lot of time by using NetLogo instead. Agent-based modeling is what it does.