#!/usr/bin/perl -w use strict; use Benchmark; timethese([X], { 'while' => sub { $_ = 0; while (1) { $_++; last if ($_ == 1000); } }, 'for' => sub { $_ = 0; for (;;) { $_++; last if ($_ == 1000); } }, 'block' => sub { $_ = 0; { $_++; redo if ($_ < 1000); } } });