use integer; [...] sub trivial_loop { my $from = shift; my $to; my $i; my $count = length $from; for ($i = 0; $i < $count; $i++) { $to = substr $from, $i, 1 } } sub duff { my $from = shift; # real life would use reference here, this is a demo my $to; # dummy: simulate write to serial i/o port my $i = 0; my ($n, $count); $count = length $from; $n = ($count + 7) / 8; # use integer in effect goto l. ($count % 8); # number-only labels don't work :-( l0: do { $to = (substr $from, $i++, 1); l7: $to = (substr $from, $i++, 1); l6: $to = (substr $from, $i++, 1); l5: $to = (substr $from, $i++, 1); l4: $to = (substr $from, $i++, 1); l3: $to = (substr $from, $i++, 1); l2: $to = (substr $from, $i++, 1); l1: $to = (substr $from, $i++, 1); } while (--$n>0); }