Hello,
I'm trying to understand a particular Perl code from vcake. Usually I find my way around in Perl but the following statement baffles me. I suspect that this is simply an error but I'm not completely sure. The statement is:
foreach my $seq (keys %$set) {
if( (defined $set->{$seq}) and (my $numReads >= ($coverage)) ) {
do something;
}
...
}
$coverage has been defined at the beginning of the file as a scalar integer (e.g. 10) and is never again written to. $numReads is only used in the line above, nowhere else!
$set, on the other hand, is modified inside the loop so the first part of the condition makes perfect sense. What I don't understand is the second part because as I see it, this will always evaluate to the same value and I don't understand the significance of $numReads or >= here. Can someone please enlighten me? Are there perhaps invisible automatic variables involved?