in reply to Printing matched lines

If your code is cut-n-pasted, part of your problem lies in the snippet below, where you re-open the file you plan on printing to, but as read-only.

open(ALIVEIP, ">aliveip.list"); close(ALIVEIP); open(ALIVEIP, "aliveip.list");

Also, do you really need to chomp when reading from <PINGALLIP>? If you want each message printed on a line by itself, you can just use...

while ( my $line = <PINGALLIP>) { print ALIVEIP $line if $line =~ /is alive/; }

    --k.