rocroc has asked for the wisdom of the Perl Monks concerning the following question:
Here is a text file containing data I need to munge:
Here is a perl script to do some munging:"ADELMAN","John","adad","Ray" "AGAN","John","agag","Aditya" "AHMED","John","ahah","Conor"
Here is the output when I invoke perl test.pl test.txt at the command line:my $username; my $color; while(<>){ chomp; s/"//g; ($username,$color) = (split /,/,$_)[2,3]; if ("agag" =~ m/($username)/){print STDOUT "here is the username: +$username\n"} }
so note what's happening here: Evidently, the interpolation of the variable $username works just fine in the match "agag" =~ m/($username)/. But then, $username get's treated as empty (uninitialized?) inside the call to print. I'm totally stumped. please help.here is the username:
Back to
Seekers of Perl Wisdom