#!/usr/bin/perl use strict; use warnings; use lib '/home/suse/junk/automation1/emulex'; use Config::Simple; use Net::Ping::External qw(ping); use 5.010; #myconf.cfg is a file with all hosts my $cfg = new Config::Simple('/home/suse/junk/automation1/emulex/myconf.cfg'); #accessing values my $host = $cfg->param("host1"); print "checking $host is reachable or not\n"; my $alive = ping(hostname => "$host", count => 5, size => 1024, timeout => 3); print "$host is alive!\n" if $alive or die"Could not ping host '$host' ";