in reply to Re: Generate list with array elements repeated x times
in thread Generate list with array elements repeated x times

Excellent. Your code did just what I needed to get the desired output. But as my code makes a list of dates depending on variable start and end dates, I needed to use


my @mults = split(' ', $dates); return (("$first") x 10), (map { ($_) x 10 } @mults), (("$last") x 10) +;

....to get each of the elements listed in the desired form. Just searching on, "use variables with qw()" pointed me to split. I knew it was simple. Now I can see the next tree behind this one in the forest. Thanks choroba.

Replies are listed 'Best First'.
Re^3: Generate list with array elements repeated x times
by choroba (Cardinal) on Oct 16, 2014 at 21:07 UTC
    No problem. You can simplify it to
    return map { ($_) x 10 } $first, @mults, $last
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ