finishing up the perl simulation script