##
foo01bar-fred
foo02bar-fred
...
foo100bar-fred
foo01bar-barney
...
foo100bar-wilma
####
#!/usr/bin/perl -ln
use strict;
use warnings;
sub expand;
sub doit;
print for expand $_;
sub expand {
doit split /\[(.*?)\]/, shift, -1;
}
sub doit {
return @_ if @_ == 1;
my ($pre,$pat,$post)=splice @_, 0, 3;
map { doit $pre . $_ . $post, @_ }
map { /(\w+):(\w+)/ ? $1..$2 : $_ }
split /,/, $pat;
}
__END__