in reply to How to remove duplicate IPs
open (NMAP_DATA, "@ARGV") or die "Please type the filename. $!" ;
That should probably be:
open (NMAP_DATA, $ARGV[0]) or die "Please type the filename. $!" ;
But would be even better as:
open NMAP_DATA, '<', $ARGV[0] or die "Cannot open '$ARGV[0]' because: +$!";
my @ip_address = sort $1, "\n" if /($RE{net}{IPv4})/; print IP_DATA @ip_address if (!/^\s*$/);
Why are you sorting the two values $1 and "\n"? Why are you using an array when you only need a scalar?
print IP_DATA "$1\n" if /($RE{net}{IPv4})/;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to remove duplicate IPs
by sinhass (Initiate) on Aug 08, 2013 at 03:15 UTC |
In Section
Seekers of Perl Wisdom