perl -we '@a = qw"a b"; while (my $x = pop @a) { push @x, \$x; print \$x, ": ", ($x || 0), "\n"; redo if 0 != @x % 3; }; '