#!/usr/local/bin/perl while (<>) { s/([A-Z]+)/reverse($1)/ge; print; }