use strict; # This should go at the top of the file use warnings; # So should this, to catch errors. open FILE, ") { my ($name,$email,$number) = split(/,/,$_); if ($name =~ /$name2/i) { print "$_\n"; } }