for my $i (1 .. 15) { if((my $first = $i==5) ... (my $last = $i==10)) { # note: $first will be undefined for any but the first line because of the 3 dots # and $last will be undefined for the first line local $^W; print "$i - $first / $last\n"; } }