problem 1 in perl