fixed perl script