in reply to Re^2: Can anyone tell me what is going on with my code?(Regex match variables)
in thread Can anyone tell me what is going on with my code?(Regex match variables)
$2 is undefined when you assign it to $mac2 because you ran another regex in between, and that regex cleared $2. Assign $2 to $mac2 before the substitution, and it will work OK.