in reply to dynamic map "quadrant" indexing
Update: I think the glob-based solution in my other reply is the way to go; I wish I'd thought of it first. Ignore this one.
Here's a recursive solution:
use strict; use warnings; my $lvl = shift || 2; my @indices = indices( $lvl ); print "$_\n" for @indices; sub indices { my $lvl = shift; die if $lvl < 0; return $lvl ? map make_indices( $_ ), indices( $lvl - 1 ) : ( '' ); } sub make_indices { my $base = shift; return map "$base${_}1", 'A' .. 'D'; }
the lowliest monk
In Section
Seekers of Perl Wisdom