if (/[\x20]{5}\(base 16\)[\t]{2}/) { ... if ($_ =~ m/([\d]+\.[\d]+\.[\d]+\.[\d]+).*([\w]{4})\.([\w]{4})\.([\w]{4})/i) { #### if (/\x20{5}\(base 16\)\t{2}/) { ... if ($_ =~ m/(\d+\.\d+\.\d+\.\d+).*(\w{4})\.(\w{4})\.(\w{4})/i) { #### open(INPUT, $ARGV[0]) || die "Cannot do eet! $!"; # Takes the input file name on the command line and builds an array. while () { # This is the ARP Cache file created from a copy/paste of a routers push @data, "$_"; # show arp command. } close(INPUT); for (@data) { # This section iterates over the ARP cache array and pulls the IP and MAC address out and stores it into a hash if ($_ =~ m/([\d]+\.[\d]+\.[\d]+\.[\d]+).*([\w]{4})\.([\w]{4})\.([\w]{4})/i) { # Key is MAC my $temp = $2.$3.$4; # Value is IP $hash{$temp} = $1; } }