in reply to Re^3: Regex matching part of one hash key to another
in thread Regex matching part of one hash key to another
Monks of Wisdom,
So, after a bit of a break from this to do other work, I'm trying (once again) to resolve the previous issues and now I am seeing some warnings in my output. To my beginners eyes it appears there may a Case issue. I noticed the only difference between the output line that matches and the ones that fail is that the match portion are all numbers. Futhermore, when I checked the data files I noticed the input search strings are in lowercase and the oui strings to match against are in UPPERCASE. Currently using oko1's version of code (shown below) for simplicity. THANKS!I updated one line and got it to work finally!#!/usr/bin/perl -w use 5.010; use strict; my %oui; open my $list1, "ouisample.txt" or die "ouisample.txt: $!\n"; while (<$list1>){ if (/^(.*?) {5}\(base 16\)\t\t(.*)$/) { $oui{$1} = $2; } } close $list1; while (<>){ if (/((?:\d+\.){3}\d+).*([\w.]{14})/i){ (my $temp = $2) =~ tr/.//d; print "$1 mapped to $temp for company ", $oui{substr $temp, 0, + 6}, "\n"; } }
Thanks a bunch, I'm so excited the script finally works as hoped.(my $temp = uc($2)) =~ tr/.//d;
|
|---|