"Sayed, Irfan (Irfan)" schreef:

> I need to split following string
>
> cs_backup_restore_cmvobsvr1mum
>
> the output which i am looking for is
>
> cs_backup_restore and _cmvobsvr1mum

$ perl -Mstrict -wle '
  $_ = "cs_backup_restore_cmvobsvr1mum" ;
  @_ = split /(_)/ ;
# print for @_ ;
  $" = "\t" ; print for "@_[0..$#_-2]", "@_[-2..-1]", "" ;
  $" = ""   ; print "@_[0..$#_-2] and @_[-2..-1]" ;
'
cs      _       backup  _       restore
_       cmvobsvr1mum

cs_backup_restore and _cmvobsvr1mum

-- 
Affijn, Ruud

"Gewoon is een tijger."



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to