#!/usr/bin/perl # important to initialize variable before loop! $i=0; do { print "i = $i\n"; $i++; # need this line to avoid infinite loop! } while ($i < 3); # prints the following: # i = 0 # i = 1 # i = 2