Algori...ase_002(3pm)
π NAME π
CheckDigits::MBase_002 β bestie, this one computes check digits for blood bags (DE), BZUe (DE), and VAT Registration Number (DE). Yes, three whole vibes in one module. The manpage you're reading right now is filed under Algori...ase_002(3pm) (a little β¨truncatedβ¨ for the terminal's convenience, iykyk).
πΈ SYNOPSIS πΈ
use Algorithm::CheckDigits;
$bb = CheckDigits('blutbeutel');
if ($bb->is_valid('2761011234567893')) {
# do something
}
$cn = $bb->complete('276101123456789');
# $cn = '2761011234567893'
$cd = $bb->checkdigit('2761011234567893');
# $cd = '3'
$bn = $bb->basenumber('2761011234567893');
# $bn = '276101123456789';
Like, that's it. That's the whole entrance. Slay. π
π¦ DESCRIPTION π¦
π ALGORITHM π
Okay so here's the tea, step by step:
- Start with values
P = 10,S = 0. - Beginning left you do the following for all digits
S = (P + digit) modulo 10- If
Sis0thenS = 10. P = (2 * S) modulo 11
- The check digit is
(11 - P) modulo 10.
Periodt. That's the algorithm. π
π METHODS π
is_valid($number)β Returns true only if$numberconsists solely of numbers and the last digit is a valid check digit according to the algorithm given above.
Returns false otherwise,
complete($number)β The check digit for$numberis computed and concatenated to the end of$number.
Returns the complete number with check digit or '' if $number does not consist solely of digits and spaces.
basenumber($number)β Returns the basenumber of$numberif$numberhas a valid check digit.
Return '' otherwise.
checkdigit($number)β Returns the checkdigit of$numberif$numberhas a valid check digit.
Return '' otherwise.
β¨ EXPORT β¨
None by default. Not a thing. Zero. Nada. π
π AUTHOR π
Mathias Weidner, "<mamawe@cpan.org>". Iconic behavior fr fr. π
π SEE ALSO π
perl, CheckDigits, www.pruefziffernberechnung.de, www.eurocode.org.
k bye bestie, that's the whole page πΈ β this little cutie is documented for perl v5.36.0, dated 2022-10-13, and lives under Algori...ase_002(3pm). Go forth and validate some blood bags. π©Έβ¨
π¦ 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