in reply to Re^9: Comparing 2 different-sized strings
in thread Comparing 2 different-sized strings

How do you know which part refers to which sequence ($s1 vs $s2 for example)?

Sorry, but you are going to have to clarify that question. Which "part" of what?

(You should also have used <code></code> tags;

and it is helpful when you reference another post to link to it Re: Hamming Distance Between 2 Strings - Fast(est) Way? using [id://500244])


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.

Replies are listed 'Best First'.
Re^11: Comparing 2 different-sized strings
by AdrianJ217 (Novice) on Aug 13, 2013 at 20:27 UTC
    Oh, sorry. In the part of the code where you have:
    sub hd{ length( $_[ 0 ] ) - ( ( $_[ 0 ] ^ $_[ 1 ] ) =~ tr[\0][\0] ) }
    You are submitting 2 parameters (2 dna sequences) to the subroutine, so in the above code which computes the hamming distance, how do you know which variable refers to which sequence? Or could you just explain what the code above is doing? Thank you so much!

      See perldoc/perlsub for details, but basically $_[0] is the first parameter passed; $_[1] is the second; and so on.

      You could always name them in the usual way, but why bother with such a simple subroutine. Beside which, it is more efficient not to.


      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.
      The distance between A and B is the same as the distance between B and A. You do not need to know.
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ