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


in reply to A Semi-automatic word search solver

Here is a small subroutine (really only one line long) to make the building of your @puzzle array even easier.
use strict; use warnings; use Data::Dumper; my @puzzle = qw/abcde fghij klmno pqrst uvwxy/; @puzzle = make_puzzle(@puzzle); print Dumper(\@puzzle); sub make_puzzle{ return map{[split //, $_]} @_; }
One question if I may: Why are you using subroutine prototypes in your search subroutine?

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James