I get the warning when $a or $b is 'etc' or "ccp". and it seems to be tied to the two lines I commented on. The if statement above them does not cause any problems, but I assume that's because neither site has any numbers in them(?). Is there something I can do to eliminate the warnings or can I just ignore them (and add a no warnings numeric)? Using Perl 5.16.3.
my %site = (
24j1 => { count=>1, devices=>['192.168.0.1'] },
1924 => { count=>3, devices=>['192.168.1.1','192.168.1.3','192
+.168.1.9'] },
etc => { count=>2, devices=>['192.168.2.1','192.168.2.23'] },
ccp => { count=>1, devices=>['192.168.3.1'] },
);
sub my_sort {
if( ("$a" ~~ @datacenters) && ("$b" ~~ @datacenters) ) {
return $site{$b}->{count} <=> $site{$a}->{count};
}
if( ("$a" ~~ @datacenters) && ! ( "$b" ~~ @datacenters) ) { retu
+rn $a } # Warnings go away if I
if( ("$b" ~~ @datacenters) && ! ( "$a" ~~ @datacenters) ) { retu
+rn $b } # comment out these two lines.
if( ( $a =~ $eu_regex ) && ( $b !~ $eu_regex ) ) { retu
+rn $a }
if( ( $b =~ $eu_regex ) && ( $a !~ $eu_regex ) ) { retu
+rn $b }
return $site{$b}->{count} <=> $site{$a}->{count};
}
foreach my $site ( sort my_sort keys %site ) {do_stuff_with($site) }