in reply to multiple checks on a conditional
I think it's not going to make that big of a difference to have it check if the $regex variable is there or not. But if it bothers you, by looking at your code I think you can just do
sub execute { return unless $regex; # ...and then do the rest }
As a sde note, if $regex never changes within the scope of execute(), you might want to optimize how the regex is treated, instead of worrying about conditionals
Something like:
sub execute { my $compiled = qr/$regex/; ..... for...{ nex if $host !~ /$compiled/; } }
|
|---|