I am curious whether anyone else would like to see else clauses applied to for/foreach and while loops, where the code in the else clause would be executed if the loop body was completely skipped due to the conditions/boundaries. So for example:

…with a for/foreach loop:

for my $temperature ($temp_lower_bound .. $temp_upper_bound) {

set_temperature($temperature, $soak_time);

push @data, get_sensor_reading();

}

else {

die "Temperature upper bound must be greater than lower bound!

";

}



foreach my $datum (@data) {

print "processing $datum...

";

process($datum);

}

else {

warn "No data!

";

}

…with a while loop:

open LOG_FILE, "<", $log_file

or die "Could not open log file: $!

";

while (<LOG_FILE>) {

process_log_entry($_);

}

else {

print "The log file was empty!

";

}

close LOG_FILE;