perl to convert python to perl