in reply to scoping problem?
Are you sure you're modifying / running the same Perl script? Because for me, the following works:
use strict; my $username; my $color; while(<DATA>){ chomp; s/"//g; ($username,$color) = (split /,/,$_)[2,3]; if ("agag" =~ m/($username)/){ print STDOUT "here is the username: $username\n" } } __DATA__ "ADELMAN","John","adad","Ray" "AGAN","John","agag","Aditya" "AHMED","John","ahah","Conor"
... and outputs:
here is the username: agag
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: scoping problem?
by ww (Archbishop) on Dec 06, 2011 at 19:55 UTC |
In Section
Seekers of Perl Wisdom