$ curl -sS -o m#1 'http://tinymicros.com/pm/index.php?goto=MonkBirthdays&start={0,50,100,150,200,250,300,350,400,450,500,550,600,650}'
$ perl -le 'for (0..13) {$x=$_*50;$y=sprintf q{%02d}, $_; system(qq{mv m$x monk_birthday_$y.html})==0 or die;}'
$ perl -wlne 'print $1 if m{^
(\d{4}-\d{2}-\d{2}) | $};' m* > dates.dat
$ vi dates.dat
656 birthdays
- 4 are over 100
- 38 give birthday but not birthyear
- 5 are 7 years old or less
- 1 is negative (time traveler?)
---
608 valid birthdays
$ perl -MDateTime -MDateTime::Format::ISO8601 -wlne 'BEGIN{$today=DateTime->today()} my $dt = DateTime::Format::ISO8601->parse_datetime($_) or die; print $today->subtract_datetime($dt)->years' dates.dat > ages_in_years.dat
$ perl -MDateTime -MDateTime::Format::ISO8601 -wlne 'BEGIN{$today=DateTime->today()} my $dt = DateTime::Format::ISO8601->parse_datetime($_) or die; print $today->subtract_datetime($dt)->delta_months' dates.dat > ages_in_months.dat
$ perl -wlne '$h{int($_/10)}++; END{printf qq{%7d\t%d-%d\n}, $h{$_}, $_*10,($_+1)*10-1 for sort keys %h}' ages_in_years.dat
10 10-19
224 20-29
279 30-39
73 40-49
18 50-59
4 60-69
$ perl -wlne '$c++; $t+=$_; END{print "Average: ", $t/$c/12}' ages_in_months.dat
Average: 33.1097861842105