implemented tutorial 23 in perl