Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: split string using optimized code or perl one liner (updated)

by haukex (Archbishop)
on Feb 22, 2017 at 14:11 UTC ( [id://1182527] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ echo abc.def.ghi.jkl.mno | \
      perl -lne 'print join ".", reverse split /\./'
    mno.jkl.ghi.def.abc
    
  2. or download this
    $ echo abc.def.ghi.jkl.mno | \
      perl -F'\.' -lpe'$_=join".",reverse@F'
    mno.jkl.ghi.def.abc