in reply to elements not reversing inside a map
Roy Johnson has a working solution. The following will also do the trick:
perl -le '$_="filename.ext"; s/^(.*)\.([^.]*)$/$2:$1/; print($_);'
Both Roy's and mine splits at the last ".", just like you were trying to do.
By the way, I would further postulate that extentions don't have spaces in them:
perl -le '$_="filename.ext"; s/^(.*)\.([^.\s]*)$/$2:$1/; print($_);'
|
|---|