http://qs321.pair.com?node_id=11108248


in reply to Re: Inputing vectors into a scrabble-esque game
in thread Inputing vectors into a scrabble-esque game

Perhaps you can save some fiddly typing map'ing the product of two source arrays to produce the @letters array. It doesn't look quite as straightforward but might be less prone to typos.

use 5.026; use warnings; my @letters = do { my @chars = ( q{a} .. q{z} ); my @counts = ( 9, 2, 2, 4, 12, 2, 4, 2, 9, 1, 1, 4, 2, 6, 8, 2, 1, 6, 4, 6, 4, 2, 2, 1, 2, 1 ); map { ( $chars[ $_ ] ) x $counts[ $_ ] } 0 .. 25; }; say join q{}, @letters;

Produces:-

aaaaaaaaabbccddddeeeeeeeeeeeeffgggghhiiiiiiiiijkllllmmnnnnnnoooooooopp +qrrrrrrssssttttttuuuuvvwwxyyz

I hope this is of interest.

Cheers,

JohnGG