title: Perl Hex CRC-16 bit script
body: <p>I'm new to perl and i would like to know why the arguments are not correcly passed to the subroutine.
  Also, are the output values correct?</p>
  
  <pre><code>use strict;
  
  sub crc16 {
       use constant POLY =&gt; $_[1];
       my $crc = 0;
       for my $c ( unpack 'C*', $_[0] ) {
           $crc ^= $c;
           for my $b ( 0 .. 7 ) {
               my $carry = $crc &amp; 1;
               $crc &gt;&gt;= 1;
               if( $carry ) {
                   $crc ^= POLY;
               }
           }
       }
       return $crc;
  }
  
  my $data = "1234";
  my $poly = "0x8005";
  
  printf "crc: %04x\n", crc16( $data, $poly );
  </code></pre>
  
  <p>Thanks!</p>