answer 7 in perl so it is fast and fun
answer 6 performance analysis