use strict; my $username; my $color; while(<>){ chomp; s/"//g; ($username,$color) = (split /,/,$_)[2,3]; print STDOUT "$username\n"; #NEW if ("agag" =~ m/($username)/){print STDOUT "here is the username: $username\n"} } #### adad agag ahah here is the username: #### use strict; 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" } } __DATA__ "ADELMAN","John","adad","Ray" "AGAN","John","agag","Aditya" "AHMED","John","ahah","Conor" #### here is the username: agag