#!/usr/bin/perl -w use warnings; use strict; #use diagnostics; use Data::Dumper qw (Dumper); my $inputfile = $ARGV[0]; my @filedata; my $pattern = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/[0-9]?[0-9]$/; my @temps; my $counter = 0; open (INPUT, "<$inputfile") or die "no file for proccessing provided or existing"; while () { push (@filedata, $_); } foreach (@filedata) { if ($_ =~ /$pattern/) { $counter++; #my $temp = (split ' ', $_); push (@temps, (split /\s/,$_)); } } close INPUT; #print "@temps\n"; # foreach (@temps) { if ($_ =~ /$pattern/) { print "$_\n"; } } print "Found $counter matches!\n";