So, you really want to reverse each word, not each sentence, right? Or is your comma supposed to be a period?
perl -pe 's/(\w+)/ reverse $1 /eg' << END
UTS. ZYXWV. 321
STU. VWXYZ. 123
If you want to redirect, do this:
perl -pe 's/(\w+)($|\W+)/ reverse($1) . $2 /eg' < file_in > file_out
With my example, do
perl -pe 's/(\w+)($|\W+)/ reverse($1) . $2 /eg' << END > file_out
DO NOT put the redirection on the same line as the terminating word of the heredoc. If you do, the shell will not be able to find the end of the heredoc.
With redirecting to and from files, never do this:
command < file > file with the same file. The redirections happen before the command starts, and
> will truncate the file to zero length. When the command starts, the input file has already been destroyed.