my %to_combine = ( A => "0,1", B => "0,1", C => "0,1", X => "0,1", ); # Then the following prints it out... print join " ", sort keys %to_combine; print "\n"; my $s = join "\\ ", map "{$to_combine{$_}}", sort keys %to_combine; print "$_\n" for glob $s;