As NetWallah suggested, using a CPAN module will be best. Below is an example for using Net::IP. It would replace the @sn_array assignment and the "foreach $host" loop in the original code
use Net::IP;
my @sn_array = qw( 172.22.0.0/30 7.3.1.0/24 );
...
for my $net (map {new Net::IP $_} @sn_array) {
do {
$manager->start and next;
my $p = Net::Ping->new("icmp");
my $host = $net->ip;
print "pinging $host\n";
if ($p->ping($host)){
open PingFile, ">>", "$pingable" or die $!;
flock(PingFile, LOCK_EX);
print PingFile "$host\n";
flock(PingFile, LOCK_UN);
close(PingFile);
}
$manager->finish;
} while (++$net);
}