Output: yes yes yes yes perhaps perhaps maybe maybe maybe maybe maybe no no nouse Modern::Perl; my %hash = ( yes => 4, no => 3, maybe => 5, perhaps => 2, ); my @flatlist = map { ($_) x $hash{$_}} keys %hash; say "@flatlist";
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
In reply to Re: Pushing Element Multiple Times to Array
by CountZero
in thread Pushing Element Multiple Times to Array
by atancasis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |