https://github.com/personnummer/perl
Validate Swedish personal identity numbers
https://github.com/personnummer/perl
perl personal-identity-number personnummer social-security-number validation
Last synced: about 1 year ago
JSON representation
Validate Swedish personal identity numbers
- Host: GitHub
- URL: https://github.com/personnummer/perl
- Owner: personnummer
- License: mit
- Created: 2020-04-17T10:48:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-14T21:23:41.000Z (about 1 year ago)
- Last Synced: 2025-06-06T00:00:02.651Z (about 1 year ago)
- Topics: perl, personal-identity-number, personnummer, social-security-number, validation
- Language: Perl
- Homepage:
- Size: 71.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# perl-personnummer
Validate Swedish [personal identification
numbers](https://en.wikipedia.org/wiki/Personal_identity_number_(Sweden)) with
[Perl](https://www.perl.org/)
## Usage
Install with `cpanm` (or your preferred tool).
```perl
#!/usr/bin/env perl
user warnings;
use strict;
use Personnummer;
my $pnr = Personnummer->new( $ARGV[0] );
if ( !$pnr->valid() ) {
die "Invalid personal identity number";
}
my $gender = $pnr->is_female() ? "female" : "male";
printf( "The person with personal identity number %s is a %s of age %d\n",
$pnr->format(), $gender, $pnr->get_age() );
```