My results are similar to choroba's. I suspect rocroc is being a bit coy with us about the code or data actually being used because I don't get the same output from the the posted code of Re^3: scoping problem?. I am using a data file with the OPed data plus a blank line at the end.
I have made minor code changes as follows:
As you can see, the 'agag' record is detected (as well as the blank line, of course).
>perl -wMstrict -le "my $username; my $color; while(<>){ chomp; s/\x22//g; ($username,$color) = (split /,/,$_)[2,3]; print STDOUT \"test of username: '$username'\n\"; print STDOUT \"test of dollar-underscore: '$_'\n\"; if (\"agag\" =~ m/($username)/){ print STDOUT \"here is the username: '$username'\n\"; print STDOUT \"here is dollar-underscore: '$_'\n\"; } } " data test of username: 'adad' test of dollar-underscore: 'ADELMAN,John,adad,Ray' test of username: 'agag' test of dollar-underscore: 'AGAN,John,agag,Aditya' here is the username: 'agag' here is dollar-underscore: 'AGAN,John,agag,Aditya' test of username: 'ahah' test of dollar-underscore: 'AHMED,John,ahah,Conor' Use of uninitialized value $username in concatenation (.) or string at + -e line 1, <> line 4. test of username: '' test of dollar-underscore: ' ' Use of uninitialized value $username in regexp compilation at -e line +1, <> line 4. Use of uninitialized value $username in concatenation (.) or string at + -e line 1, <> line 4. here is the username: '' here is dollar-underscore: ' '
In reply to Re^4: scoping problem?
by AnomalousMonk
in thread scoping problem?
by rocroc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |