#!/usr/bin/perl
open (FILE, 'data.txt');
while (<FILE>) {
($ip,$me,$id) = split(" ");
print "Ip: $ip\n";
open(F,'>ip.txt') || die $!;
print F "$ip \n" ;
close(F);
print "me: $me\n";
print "ID: $id\n";
print "---------\n";
}
close (FILE);
exit;
I want perl to print
output within newlines in the file to which it is writing. How can I check if a line in the input file is null or not.
I would like the output to look like this (in ip.txt
):
123.121.121.0
545.45.45.45
..
..
etc