Corion's post is absolutely correct. The only addition I have to it is that both languages do the functionality of what you asked, and they do it well. The differences of perl and python are not pivoted around any of the issues you brought it.
As
Corion said, pick the one you know the best. If you don't know either, get to know your environment. Which does it support better? E.g. my workplace keeps perl nicely up-to-date but does poorly at maintaining python.