Algori...M11_010(3pm)
โจ NAME โจ
CheckDigits::M11_010 โ bestie, this is the module that computes check digits for the AHV number (CH) ๐จ๐ญ๐
(it lives in Algorithm::CheckDigits, and you'll also see it hanging out in the perl man pages as Algori...M11_010(3pm), user-contributed Perl documentation energy ๐)
๐ฆ SYNOPSIS ๐ฆ
use Algorithm::CheckDigits;
$ahv = CheckDigits('ahv_ch');
if ($ahv->is_valid('123.45.678.113')) {
# do something
}
$cn = $ahv->complete('123.45.678.11');
# $cn = '123.45.678.113'
$cd = $ahv->checkdigit('123.45.678.113');
# $cd = '3'
$bn = $ahv->basenumber('123.45.678.113');
# $bn = '123.45.678.11';
okay so literally just use it, grab CheckDigits('ahv_ch'), and go off ๐
๐ธ DESCRIPTION ๐ธ
๐งฎ ALGORITHM
no cap, the math is giving very "trust the process":
- Beginning left, every digit is weighted with
5,4,3,2,7,6,5,4,3,2. โจ - The weighted digits are added. ๐ฅ
- The sum from step 2 is taken modulo 11. ๐ซ
- The checkdigit is 11 minus the sum from step 3. Is the difference 10, the number won't be taken. If the difference is 11, the checkdigit is
0. ๐ซถ
๐ METHODS
is_valid($number)โ Returns true only if$numberconsists solely of numbers and dots and the rightmost digit is a valid check digit according to the algorithm given above. Returns false otherwise. (so basically a vibe check, but for check digits ๐)complete($number)โ The check digit for$numberis computed and appended the end of$number. Returns the complete number with check digit or''if$numberdoes not consist solely of digits and dots.basenumber($number)โ Returns the basenumber of$numberif$numberhas a valid check digit. Return''otherwise. ๐checkdigit($number)โ Returns the check digits of$numberif$numberhas valid check digits. Return''otherwise. โญ
๐ฆ EXPORT
None by default. (she's lowkey shy like that ๐)
๐ AUTHOR ๐
Mathias Weidner, <mamawe@cpan.org> ๐
๐ SEE ALSO ๐
perl, CheckDigits, www.pruefziffernberechnung.de, ๐ง
and that's the whole page bestie, slay ๐โจ โ this iconic little number came to you via perl v5.36.0, dated 2022-10-13, straight outta the Algori...M11_010(3pm) era. periodt. ๐
๐ฆ where this page comes from
- ubuntu noble: libalgorithm-checkdigits-perl 1.3.6-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libalgorithm-checkdigits-perl 1.3.6-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libalgorithm-checkdigits-perl 1.3.6-2 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms