samh785 has asked for the wisdom of the Perl Monks concerning the following question:
And the output:if ($macs[1] =~ /(\S{17})\|(\S{17})/) { print "$macs[0] MAC1: $1\n"; print "$macs[0] MAC2: $2\n"; $mac1 = $1; $mac1 =~ s/:/-/g; $mac2 = $2; $mac2 =~ s/:/-/g; #line 65 print "Converted Mac1: $mac1 Mac2: $mac2\n"; #line 66 }
ESO13 MAC1: 00:60:16:5D:4D:B4 ESO13 MAC2: 00:60:16:5D:4D:B5 Use of uninitialized value $mac2 in substitution (s///) at ipcheck.pl +line 65, <STDIN> line 1. Use of uninitialized value $mac2 in concatenation (.) or string at ipc +heck.pl line 66, <STDIN> Converted Mac1: 00-60-16-5D-4D-B4 Mac2:
For some reason $2 is uninitialized the second time I try to use it. The same exact code for $1 works. Any ideas why this might be happening? Any help is greatly appreciated!
|
|---|