in reply to problem with regex

davido's (almost) exhaustive answer ++ should give you plenty to chew on... for this and many other regex issues.

But I read your goal a bit differently -- based on your apparent failure to fully understand code tags (your last line needs them around abc10 to make it read as something other than a link). Since it is a link, I'm going to work on the assumption you really meant what you said, above, abc10.

... and davido's answer covers that... but if you want your regex to match a line which contains exactly abc10 and nothing else, then you have this additional option:

See below.  =~ /^abc10/$ (where "$" is another way to send EOL)
On another hand, if you'd like to match abc10, abc01 and abc11, you can use a character class (that's what a set of chars/digits inside square brackets is called):
#!/usr/bin/perl use 5.014; my @ar=('abc10', 'abc11', 'abc01', 'abc02', 'abc111'); for $_( @ar ) { if( $_ =~ /^abc[10]{2}/Z/ ) # wrong; see below { say $_; } }
where the "^" is another way to say, 'match at the start of the string' and the curly-wrapped "2" is a quantifier -- match a 1 or a 0 and do so exactly 2 times.

This little script spits out:

983013.pl abc10 abc11 abc01

Update: Two bad screwups in one post. Thanks to AnomalousMonk for msg'ing me about them.

First code sample should have the EOL marker, $, inside the regex-terminating "/". My bad!

Second snippet, line seven, should be \Z as it was in the code I actually tested... after posting the inaccurate version. i.e., if( $_ =~ /^abc[10]{2}\Z/ )

Apologies to any who tried to use the advice.