in reply to Re: 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)

If you look in the output I'm expecting all :'s to be replaced with -'s. This worked for $mac1 but not for $mac2. Not sure what you mean by I'll need to copy the value(especially when I didn't need to for the first variable?). Thanks for looking into this.
  • Comment on Re^2: Can anyone tell me what is going on with my code?(Regex match variables)

Replies are listed 'Best First'.
Re^3: Can anyone tell me what is going on with my code?(Regex match variables)
by Laurent_R (Canon) on Sep 30, 2015 at 17:54 UTC
    $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.