@a = (1..3); for (@a) { print; push @a, $_ + 3 if $_ % 2 == 1; }