Help for this page

Select Code to Download


  1. or download this
         my $n = unpack("v", $str);
         $str = substr($str, 1);
    
  2. or download this
    $ time perl -e '$a = "a" x 20_000; $a = substr($a, 1) while length($a)
    +;'
    user    0m0.350s
    
    ...
    
    $ time perl -e '$a = "a" x 80_000; $a = substr($a, 1) while length($a)
    +;'
    user    0m2.683s
    
  3. or download this
         my $n = unpack("v", substr($str, $off, 2));
         $off += 2;
    
  4. or download this
        my $n = unpack("v", substr($str, $off, 2, ""));