fix script to run on newer perl versions