C:\>perl -le"$_=shift; s/\b(\w)(\w*)(\w)\b/$3$2$1/g;print" "12345 AbcD" 52341 DbcA C:\>perl -le"$_=shift; s/\b(\w)(\w*)(\w)\b/$3$2$1/g;print" "12345 52341 C:\>perl -le"$_=shift; s/\b(\w)(\w*)(\w)\b/$3$2$1/g;print" "AbcD DbcA C:\>perl -le"$_=shift; s/\b(\w)(\w*)(\w)\b/$3$2$1/g;print" "AbcD 12345" DbcA 52341 C:\>