Created
January 26, 2018 01:04
-
-
Save hc0d3r/29dc2d551796fdde495fa6a5b83efe93 to your computer and use it in GitHub Desktop.
gerador de cpf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my(@cpf, $sum); | |
push @cpf, int rand 10 foreach (2 .. 10); | |
map { $sum += $cpf[$_] * (reverse 2..10)[$_] } 0..8; | |
push @cpf, $sum * 10 % 11 % 10; | |
map { $sum += $_ } unpack('(A)10XA', join('', @cpf)); | |
push @cpf, $sum * 10 % 11 % 10; | |
print join('', @cpf) . "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
de 22 linhas foi pra 7 vc é good d+