It is a bad idea to put a last there.
- If this if statement is inside a loop, you will go out of the loop, which is not what you want;
- If this is not inside a loop, Perl does not like it;
Actually I sometime intentionally add blank else blocks in my code, simply to tell myself that, "I DID think about whether anything need to be done in the else branch, but really nothing need to be done here, I didn't foget".
To do that, simply leave it blank, or put a ; there.
use strict;
use warnings;
my $var;
if ($var) {
print $var;
} else {
;
}
print "Hello World!";