When you have to start munging data or can't readily rely on commandline utilities to do what you need but stringing them together with pipes, it is time to switch from shell to Perl.
in reply to At what point do you rewrite that old shell script in Perl?
In general, a shell program should not be that large or take too many commandline options. For that matter, Perl utilities shouldn't either. No script, no matter what language, should be too big - nor should it be a kitchen sink type app that tries to do too much. Remember, do one thing, and do it well :)
I suggest trying to keep to small shell scripts that bind together specialized utilities. You may find it nicer to create the specialized utilities in Perl, then use them inside of a shell script. The unix "everything is a filter" mantra works pretty well, too, if you separate things properly.