#!/usr/bin/perl -w use strict; my $infile = './ftp.txt'; my $outfile = './fileout.csv'; my (@ips, @names, @ports, @service, @desc); open INFILE, "$infile" or die "Can't open $infile: $!\n"; while (){ chomp; next unless (/\*/); my ($ip, $name, $port, $service, $desc) = (split /\s+/)[2,3,6]; push (@ips, $ip); push (@names, $name); push (@ports, $port); } close INFILE; foreach (@ips){ print "Here are the ip's:$_\n"; } foreach (@names){ print "Here are the server names:$_\n"; } foreach (@ports){ print "Here are the ports:$_\n"; }