my $i=1; my $end= 2; while ($i++<$end) { $end++; } #### y @a = (1); foreach (sort @a) { push @a, 1; }