#!/usr/local/bin/perl # day 2015-04 use strict; use warnings; use v5.32; use Digest::MD5 qw( md5_hex ); my $input = "bgvyzdsv"; my $answer = 0; my $md5_hash; do { $answer += 1; $md5_hash = md5_hex( $input . $answer ); } until ( $md5_hash =~ m/\A0{5}/ ); say "part 1: ", $answer; do { $answer += 1; $md5_hash = md5_hex( $input . $answer ); } until ( $md5_hash =~ m/\A0{6}/ ); say "part 2: ", $answer;