sub foo { my $s = shift; if (defined $s) { if ($s ne "") { # # 150 lines of code # } else { die "String is empty"; } } else { die "String is null"; } } => sub foo { my $s = shift; unless (defined $s) { die "String is null"; } if ($s eq "") { die "String is empty"; } # # 150 lines of code # }