in reply to Generating combinatorial strings

Again, using glob seems simplest.

use strict; use warnings; use 5.010; my %molecules = ( a => 3, b => 2, c => 3, ); my $globStr = join q{}, map { qq{{@{ [ join q{,}, 1 .. $molecules{ $_ } ] }}} } sort keys %molecules; say for glob $globStr;

Produces.

111 112 113 121 122 123 211 212 213 221 222 223 311 312 313 321 322 323

I hope this is helpful.

Cheers,

JohnGG