my @bytes = unpack 'C*', $encoded_value; if (@bytes == 1) { push @output, $bytes[0]; } elsif (@bytes == 2) { push @output, (( $bytes[0] & 0x1F ) << 6 ) | ( $bytes[0] & 0x3F ); } elsif (@bytes == 3) { push @output, (( $bytes[0] & 0x0F ) << 12 ) | (( $bytes[0] & 0x3F ) << 6 ) | ( $bytes[0] & 0x3F ); } ...