in reply to I need help with pattern matching

I'd do it this way:
use strict; use warnings 'all'; use Regexp::Common; while (<DATA>) { if (/$RE{net}{MAC}{hex}{-sep => '-'}{-keep}/i) { print "New string is: ", substr ("$5$6$7" => 1), "kk\n"; } } __DATA__ Physical Address. . . . . . . . . : 00-B0-D0-87-52-19 DHCP Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.45.10.166
Abigail