Algori...M97_001(3pm)
π Algori...M97_001(3pm) π
okay bestie, this is a page from the User Contributed Perl Documentation manual, and it's about CheckDigits::M97_001 β the module that does check digits for Belgian VAT Registration Numbers (BE). yes that's a lot of acronyms, no we're not scared of them π
β¨ NAME β¨
CheckDigits::M97_001 β compute check digits for VAT Registration Number (BE) π
π¦ SYNOPSIS π¦
here's the whole vibe, copy-paste ready:
use Algorithm::CheckDigits;
$ustid = CheckDigits('ustid_be');
if ($ustid->is_valid('136695962')) {
# do something
}
$cn = $ustid->complete('1366959');
# $cn = '136695962'
$cd = $ustid->checkdigit('136695962');
# $cd = '62'
$bn = $ustid->basenumber('136695962');
# $bn = '1366959'
slay. it's giving "four methods, four little errands, zero drama" πΈ
π₯ DESCRIPTION π₯
β ALGORITHM β
the whole tea, in two steps, no skips:
- take the whole number (without the checksum) and do it modulo 97.
- the checksum is the difference of the remainder from step 1 to 97.
that's it. that's the algorithm. lowkey elegant fr fr.
π METHODS π
is_valid($number)
returns true if $number is made up of nothing but numbers, and the last digit is a valid check digit per the algorithm up above π
a leading 'BE' before the numbers gets ignored, bestie β it's just vibes, not data.
returns false otherwise.
complete($number)
the check digit for $number gets computed and then concatenated onto the end of $number.
returns the complete number with the check digit, or '' if $number doesn't consist solely of digits and spaces π
and a leading 'BE' before the digits? ignored for the computation, but retained for the result. main character energy, it stays. β¨
basenumber($number)
returns the basenumber of $number, but only if $number has a valid check digit.
a leading 'BE' before the digits gets ignored and is not returned with the result β ghosted, honestly π«Ά
returns '' otherwise.
checkdigit($number)
returns the checkdigits of $number, but only if $number has a valid check digit.
returns '' otherwise.
π EXPORT π
none by default. as it should be, honestly. nothing jumping out at you unprompted π
π AUTHOR π
Mathias Weidner, "<mamawe@cpan.org>" π
πΈ SEE ALSO πΈ
perlCheckDigits<http://www.pruefziffernberechnung.de><https://en.wikipedia.org/wiki/VAT_identification_number>
and that's the whole page bb π this was perl v5.36.0, dated 2022-10-13, filed under Algori...M97_001(3pm) β go forth and validate those Belgian VAT numbers, icon. 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