Can you just explain to me what the double dollar sign in front of rNee means?
It means dereference the reference.
Because genomic work often involves very large strings; and passing large strings into subroutines causes them to be copied:
sub something {
my( $string ) = @_;
## $string is a copy of the argument
}
my $hugeString = ........;
something( $hugeString );
Instead of passing the arguments directly, I pass references (kind of pointers) to them: fuzzyMatch( \$hay, \$nee, 3 ); ## pass references to needle and haysta
+ck
Within fuzzyMatch(), it receives references to the two strings: sub fuzzyMatch {
my( $rHay, $rNee, $misses ) = @_; ## the 'r's are to remind that
+these are references
So to get to the actual strings, I use a second $
my $lNee = length $$rNee; ## read as: $lenghtNeedle = length of t
+he data $, referenced by $rNee
So, $$rNee is shorthand for ${ $rNee }; if that clarifies things for you?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|