in reply to Re^3: Braino - why is this not working?
in thread Braino - why is this not working?

Details slightly off, but the essence was it.

Detail: the foreach works sets "$_" to each value in the list, in turn

print "_=$_\n" for (1..3);
but ...

Your post hit the reason for the problem. "Grep" sets $_ to each member in turn, so searching for '$_' will always return 'true' if you search on /$_/;

Absolutely simple, got caught with my 1 'register' var being double used. Sigh. Thinking about the simplicity of using $_ in 'foreach', I forgot about grep...sigh.

MUCH thanks -- very it was driving me crazy!