Perl script to create football formation

I need help to create varieties of football formation. The available positions are:

GK
SW
DR
DC
DL
WBR
DM
WBL
MR
MC
ML
AMR
AMC
AML
ST

But the conditions are:
a. the maximum number in 1 formation:

GK is 1
SW is 1
DR is 1
DC is 3
DL is 1
WBR is 1
DM is 3
WBL is 1
MR is 1
MC is 3
ML is 1
AMR is 1
AMC is 3
AML is 1
ST is 3

b. the number of position in 1 formation is 11
c. if:

DR is exist, then DL must exist
WBR is exist, then WBL must exist
MR is exist, then ML must exist
AMR is exist, then AML must exist.

I have count the number of possibility of formation is 3312. But I need to
(a) list all of them.
(b) each of the formation need to save in 1 txt file.
Any help?

Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.