in reply to matching problem
Balaton: Athanasius has replied:
... I think it’s highly unlikely that this line:
if ($line =~ ModuleMatching::MatchLAC($locus_acc_no)) {
can be correct. But without knowing what sub ModuleMatching::MatchLAC is supposed to do, it’s hard to give advice.
I agree that the definition of ModuleMatching::MatchLAC() given in the OP is most likely some sort of dummy placeholder, but in any event, the given function can be explained as follows (this is for Balaton; I believe Athanasius understands all this quite clearly):
The problematic results of these matches can be illustrated as follows:
>perl -wMstrict -le "for my $line ('', 'X', 'Y') { for my $locus_acc_no ('', 'X', 'Y') { if ($line =~ MatchLAC($locus_acc_no)) { print qq{ match: '$line' =~ MatchLAC('$locus_acc_no')}; } else { print qq{NO match: '$line' =~ MatchLAC('$locus_acc_no')}; } } } ;; sub MatchLAC { return $_[0] =~ /^X$/; } " match: '' =~ MatchLAC('') NO match: '' =~ MatchLAC('X') match: '' =~ MatchLAC('Y') match: 'X' =~ MatchLAC('') NO match: 'X' =~ MatchLAC('X') match: 'X' =~ MatchLAC('Y') match: 'Y' =~ MatchLAC('') NO match: 'Y' =~ MatchLAC('X') match: 'Y' =~ MatchLAC('Y')
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: matching problem
by Athanasius (Archbishop) on Feb 26, 2013 at 04:13 UTC | |
by AnomalousMonk (Archbishop) on Feb 26, 2013 at 20:49 UTC |