Last active
June 10, 2017 12:52
-
-
Save jreisinger/fff83e061f415d331e6d15726225e0f2 to your computer and use it in GitHub Desktop.
Exercise for Danik
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Digest::SHA qw(sha1_hex); | |
use List::Util qw(shuffle); | |
while (<DATA>) { # loop over lines of __DATA__ below | |
chomp; # remove newline | |
my ( $num, $last, $first ) = split /;/; | |
my $hashed_last = sha1_hex($last); | |
my $scrambled_num = join( "", shuffle( split //, $num ) ); | |
print "$scrambled_num;$hashed_last;$first\n"; | |
} | |
__DATA__ | |
1234567890;Smith;John | |
1234567890;Bond;James | |
1234567890;Fox;Samantha |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment