Help for this page

Select Code to Download


  1. or download this
    my @fields;
    my $bits = unpack('B*', $input);
    ...
       my $field = substr($bits, 0, $num_bits, '');
       push @fields, $field;
    }
    
  2. or download this
    use Config qw( );
    use constant UV_BITS => $Config::Config{uvsize} * 8;
    
    die if $num_bits > UV_BITS;
    push @fields, pack('B*', substr(("0" x UV_BITS).$field, -UV_BITS));