in reply to Re^2: Regex matching part of one hash key to another
in thread Regex matching part of one hash key to another

Also, Here is the parts of the oui.txt file that should match, sorry for not putting this up earlier.

I should also state, for completeness, that im using Strawberry perl 5.12.0.1 for Windows on an XP platform and have no ability to get cpan modules from work due to the firewall/proxy rules. :(

00-13-20 (hex) Intel Corporate 001320 (base 16) Intel Corporate Lot 8, Jalan Hi-tech 2/3 Kulim Hi-Tech Park Kulim Kedah 09000 MALAYSIA 00-0B-46 (hex) Cisco 000B46 (base 16) Cisco 80 West Tasman Dr. SJ-M/1 San Jose CA 95134 UNITED STATES 08-00-4E (hex) 3COM EUROPE LTD. 08004E (base 16) 3COM EUROPE LTD. 3COM CENTRE BOUNDARY WAY, HEMEL HEMPSTEAD HERTFORSHI UNITED KINGDOM UNITED

Replies are listed 'Best First'.
Re^4: Regex matching part of one hash key to another
by KevinNC (Initiate) on Jan 12, 2011 at 21:52 UTC

    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!
    #!/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"; } }
    I updated one line and got it to work finally!
    (my $temp = uc($2)) =~ tr/.//d;
    Thanks a bunch, I'm so excited the script finally works as hoped.