Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 601 Bytes

README.md

File metadata and controls

30 lines (19 loc) · 601 Bytes

perl-personnummer

Validate Swedish personal identification numbers with Perl

Usage

Install with cpanm (or your preferred tool).

#!/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() );