for my $i (1 .. 15) { if(my $cnt = $i==5 ... $i==10) { print "$i - $cnt\n"; } } prints C:\perlp>range_op.pl 5 - 1 6 - 2 7 - 3 8 - 4 9 - 5 10 - 6E0