http://www.perlmonks.org?node_id=523792

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm wondering why my regex only matches the first half of my expression and ignores my 'or' using the following line:
if (/^ifSpeed.(\d+)|^1.3.6.1.2.1.2.2.1.5.(\d+)/){ print "Index: $1\n"; }
If 'ifSpeed' is seen then the index is found but $2 is set if the second format is seen.
I'm obviously missing something here.
Thanks