To answer your question, yes you can do this in PHP, but I don't really see any benefeits of rewriting this in PHP. Perl is definitely suited to do this.
C would probably be faster but parsing text in C can be a pain in the a**.
If you are having speed issues, make a cron job out of it and run it at night. If you can't see it, it isn't slow. 🙂