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


in reply to Re^2: grep function does not recognize string
in thread grep function does not recognize string

Use <readmore> tags for long portions of code or data.

The reason is that you do not anchor your regex with ^, but you test the result of grep to be == 1. But for 4285, the result is == 2, because 4285 is contained in both 4285 and 24285.