if ($cols[11] = $target1)
looks wrong!
Perhaps, but not really. One may need to assign a variable from another
expression then test the truthness of that variable. What looks wrong if the variable is assigned to
a literal value. This will issue a syntax warning (unless warnings are disabled):
my $x;
if ($x = 'a literal value') {
# will issue warnings
}
Note that the if is (effectively) testing the contents of $target1, not equality of $target1 and $cols[11].
While you are right about the equality part, but the
if construct is effectively testing the
whole expression, not just the RHS.
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!