Adding perl solution to problem 1