It would help a lot if we could see some sample input - doesn't have to be the real thing, just the real structure. Meanwhile, just for the heck of it, here's a bit of cleanup for your code. I got queasy looking at all those hard 'or's and square brackets. :)
#!/usr/bin/perl -w use strict; my %oui; open my $list1, "oui.txt" or die "oui.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"; } }
-- Education is not the filling of a pail, but the lighting of a fire. -- W. B. Yeats
In reply to Re: Regex matching part of one hash key to another
by oko1
in thread Regex matching part of one hash key to another
by KevinNC
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |