in reply to Pingger

I assume that it's supposed to be
128.135.75.1
is alive
???
Try removing the newline in this part
 @iparray = map $ipnumber. ".$_\n",1..254 ;
And adding a newline to
foreach my $host (@iparray) { if ( $p->ping( $host )){ print " $host is alive\n ";
at the end of that.
Otherwise when it goes to print the host it copies the newline from the original array. And hence the return at the end of the IP Address. So the final product should look like this (Note: I change the ips to match my network)

#!/usr/bin/perl use warnings; use Net::Ping; use Socket; $ipnumber ="192.168.30"; chomp $ipnumber; @iparray = map $ipnumber. ".$_",1..254 ; chomp $ipnumber; #open (ERRORLOG, ">errorlog"); #open (OFFLINE,">offline"); #open (ONLINE,">online"); my $proto = 'icmp'; my $def_timeout = '5'; my $bytes = '64'; my $p = Net::Ping->new($proto, $def_timeout , $bytes); foreach my $host (@iparray) { if ( $p->ping( $host )){ print " $host is alive\n "; } #foreach my $host (@iparray) { # $testing = $p $host; # print "$testing"; # print "$host offline " unless $p->ping($host,1); # print "$host online " unless $p->ping($host,0); # print ERRORLOG "$host offline " unless $p->ping($host,1); # print OFFLINE "$host"unless $p->ping($host,1); # print ONLINE "$host online" unless $p->ping($host,0); } $p->close();

Sgt