Algori...M11_009(3pm)

๐Ÿ“ฆ
version 1.3.6 ยท 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

โœจ 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:

  1. Beginning left every digit is weighted with 2, 7, 6, 5, 4, 3, 2 ๐Ÿ”ข
  2. The weighted digits are added. ๐Ÿงฎ
  3. The sum from step 2 is taken modulo 11. ๐ŸŒ€
  4. 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 $number consists 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 $number is 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 $number if $number has a valid check digit.

Return '' otherwise.

  • checkdigit($number) โ€” Returns '' if $number is 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