http://qs321.pair.com?node_id=1182527


in reply to split string using optimized code or perl one liner

Hi madtoperl,

A oneliner you say?

$ echo abc.def.ghi.jkl.mno | \ perl -lne 'print join ".", reverse split /\./' mno.jkl.ghi.def.abc

Update: Golfed a tiny bit. If your shell causes you trouble with the backslash, try -F"[.]" instead.

$ echo abc.def.ghi.jkl.mno | \ perl -F'\.' -lpe'$_=join".",reverse@F' mno.jkl.ghi.def.abc

Documentation of the switches is in perlrun.

Regards,
-- Hauke D