in reply to Re: Generate Matrix in perl
in thread Generate Matrix in perl

You can even add the comma into the glob, so the result is more like the one requested.

$ perl -e '$,=$\=$/; print glob( "{A,B},{1,2},z" );' A,1,z A,2,z B,1,z B,2,z $

Sometimes I wonder, why I usually avoid glob...

edit: minor code changes