The underscore is a legitimate character in a variable name,so you'll have to create to the file in one of the following ways
my $fileName = "fileLocn/".$var1."_$var2.txt";
my $fileName = "fileLocn/${var1}_$var2.txt";
my $fileName = sprintf("fileLocn/%s_%s.txt", $var1, $var2);