use strict; use XML::Smart; use Parallel::ForkManager; my $xmlin = XML::Smart->new($xmlInputFile); # Read in our input file defined in $xmlInputFile # For the example posted here, I walk through the XML file where is the root node, and there are multiple 'row' elements containing various bits of data. # I also use Log4perl to perform the logging, hence the the $log->info() calls. foreach my $row (@{$xmlin->{'rows'}->{'row'}} ) { # Fork our children... $pm->start() and next; # Grab the hostname. my $host = $row->{HostName}; $log->info(qq/[$i] Checking host: $host / . ref($host)); # Do stuff... $log->info(qq/[$i] Finished checking host: $host /); $pm->finish(0, \$host ); }