Algori...M11_009(3pm)
โจ Algori...M11_009(3pm) โจ
okay bestie, so this whole page is the manual for Algori...M11_009(3pm), which lives in the User Contributed Perl Documentation part of your perl install ๐ we're ranking up the perl manual names, iykyk.
๐ NAME ๐
CheckDigits::M11_009 โ compute check digits NRIC (SG) ๐
๐ธ SYNOPSIS ๐ธ
use Algorithm::CheckDigits;
$nric = CheckDigits('nric_sg');
if ($nric->is_valid('S1234567D')) {
# do something
}
$cn = $nric->complete('S1234567');
# $cn = 'S1234567D'
$cd = $nric->checkdigit('S1234567D');
# $cd = 'D'
$bn = $nric->basenumber('S1234567D');
# $bn = 'S1234567';
see how the comments are literally doing the telling for you?? iconic. the module says what it means and means what it says โจ
๐ฆ DESCRIPTION ๐ฆ
๐ ALGORITHM ๐
okay so here's the whole vibe check, step by step, no cap:
- Beginning left every digit is weighted with
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 converted to a character according to the following table:
@cd = ('','A','B','C','D','E','F','G','H','I','Z','J', );
like, the table literally ate that assignment. note the 'Z' sitting in slot 10 and 'J' in slot 11, that's not a typo bestie, that's the table fr fr ๐
๐ METHODS ๐
is_valid($number)โ Returns true only if$numberconsists of seven digits (optional preceded by a letter out of'F','G','S','T') followed by a valid letter according to the algorithm given above.
Returns false otherwise.
complete($number)โ The check letter for$numberis computed and appended to the end of$number.
Returns the complete number with check digit or '' if $number does not consist solely of digits and letters.
basenumber($number)โ Returns the basenumber of$numberif$numberhas a valid check digit.
Return '' otherwise.
checkdigit($number)โ Returns''if$numberis valid.
Return undef otherwise.
๐ EXPORT ๐
None by default. yeah. nothing. it's giving minimalist ๐
๐ AUTHOR ๐
Mathias Weidner, "<mamawe@cpan.org>" ๐ซถ
โญ SEE ALSO โญ
perl, CheckDigits, www.pruefziffernberechnung.de,
aaaaand that's the whole page babes ๐ this one shipped as part of perl v5.36.0, dated 2022-10-13, and yes the manual name is doing that mysterious Algori...M11_009(3pm) thing because truncation said main character energy only ๐
love that for it. mwah ๐ซถ๐
๐ฆ 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