#!/usr/local/bin/perl $\ = "\n"; ($sum,$count) = (0,0); while ( $sum < 5 ) { # alter the variable used in condition $sum += rand(); $count++; print qq(Sum of $count numbers is $sum); } @nums = (0..5); while ( defined ($num = shift @nums) ) { print qq(Found $num in front of @nums); } ($sum,$count) = (0,0); while ( $sum < 5 ) { $x = rand(); next if $x < 0.5; $sum += $x; $count++; print qq(Sum of $count numbers from [0.5,1\) is $sum); }