Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to remove duplicate IPs

by jwkrahn (Monsignor)
on Aug 08, 2013 at 00:41 UTC ( #1048466=note: print w/replies, xml ) Need Help??


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

    Hi jwkrahn , thanks for your advise. And frankly speaking I am learning perl so I have no clear idea yet.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1048466]
help
Chatterbox?
[choroba]: I'm just repeating some else's words as I remembered them after having asked the same question
[choroba]: s/some/someone/
Discipulus what a pity all people do not speak only in eatalian..
[choroba]: we'd need video calls more often :)
[Discipulus]: i still suspect english has some logical 'curvature/ crookedness' that has and will have a big impact over programming
[Discipulus]: if you refere to gestures ++choroba
Discipulus still has problem with 'until' beyond simplest cases
[choroba]: ;-)
[Discipulus]: and larry studied natural languages too
[choroba]: Czechs have problems with unless

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2017-05-27 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?