This seems like a misuse for me - you need to () determine what you think.
http://perldoc.perl.org/perlre.html
Capture buffers
The bracketing construct (...) creates capture buffers. Referring to the current buffer contents later in the same pattern, use \ 1 for the first, \ 2 for the second and soon. Outside a match, use "$" instead of "\". (The designation \ works in certain circumstances outside the match. See the warning below about \ 1 versus $ 1 for details.) Going back to another part of the match is called a backreference.
So you can use
if ($str =~ /^0+(.)/) { print "matched $1"; }
If you have more than one grouped matches, they will be $ 1, $ 2, $ 3 ... etc.
if ($str =~ /(0*)(1*)/) { print "I've got $1 and $2"; }
source share