while (my ($var, $cnt) = each %hash) { push @flat, ($var) x $cnt; }