'return undef;' will always return a single value 'undef' even in list context.
sub foo { return undef } if ( my @x = foo() ) { print "oops, we think we got a result"; } --- config/cfgroot/network-functions.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/cfgroot/network-functions.pl b/config/cfgroot/network-functions.pl index 070e14d0f..7cd56f799 100644 --- a/config/cfgroot/network-functions.pl +++ b/config/cfgroot/network-functions.pl @@ -139,7 +139,7 @@ sub network2bin($) { my $netmask_bin = &ip2bin($netmask);
if (!defined $address_bin || !defined $netmask_bin) { - return undef; + return (); }
my $network_start = $address_bin & $netmask_bin;