title: How to generate XOR checksum for a string using perl
body: <p>I am trying to generate checksum for a NEMA(GPS protocol) word using perl.
  A sample NEMA word is string of characters as shown below</p>
  
  <p><code>$GPGLL,5300.97914,N,00259.98174,E,125926,A*28</code></p>
  
  <p>The checksum is calculated by taking XOR of all the characters between <code>$</code> and <code>*</code>. In this sentence the checksum is the character representation of the hexadecimal value 28.</p>
  
  <p>I tried the following:</p>
  
  <pre><code>my $NMEA_word = 'GPGLL,5300.97914,N,00259.98174,E,125926,A';
  my $uff = unpack( '%8A*', $NMEA_word );
  print "Hexadecimal number: ", uc(sprintf("%x\n", $uff)), "\n";
  </code></pre>
  
  <p>But it doesn't seem to give a correct value. Please suggest what shall be rectified</p>