CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced: Re: [yanivr78] Regex source -> destination line matches...: Edit Log

Veteran / Moderator

Mar 8, 2013, 4:44 PM

Views: 8169
Re: [yanivr78] Regex source -> destination line matches...

if you can see, there are 3 IP's within these lines,

Those sample lines have 2 IP addresses each. I'm not sure where you're getting 3 IP's. So, which IP's do you want to capture?

A couple side comments.

Please use the code tags around your code to retain the code formatting which makes it easier for us to read your script.

You should add the warnings and strict pragmas, which should be in every Perl script you write.


use warnings;
use strcit;

The strict pragma will require you to declare your vars, which is normally done by adding the 'my' keyword.

my %arguments=@ARGV;

Your script would be improved by using the Getopts::Long module for handling the parsing of the command line args.

Add to that the use of Pod::Usage module to handle the output of the usage statement and additional help documentation.

Don't use bareword filehandles. Instead, use a lexical var for the handle. Also, use the 3 arg form of open and include the reason it failed in the die statement (i.e., include the $! var in the statement).

Don't use '&' when calling a sub unless you know and understand its side effects and want/need those side effects.

(This post was edited by FishMonger on Mar 8, 2013, 4:46 PM)

Edit Log:
Post edited by FishMonger (Veteran) on Mar 8, 2013, 4:45 PM
Post edited by FishMonger (Veteran) on Mar 8, 2013, 4:46 PM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives