And you can do that in Perl as well: my $n = int (($count + 7) / 8); goto (qw !LABEL0 LABEL1 LABEL2 LABEL3 LABEL4 LABEL5 LABEL6 LABEL7!) [$count % 8]; { LABEL0: print "0\n"; LABEL7: print "7\n"; LABEL6: print "6\n"; LABEL5: print "5\n"; LABEL4: print "4\n"; LABEL3: print "3\n"; LABEL2: print "2\n"; LABEL1: print "1\n"; redo if -- $n > 0; }