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

I think this will work fine if you are bothered about the last word after 
underscore:

Ajay> perl -e 'my $str='cs_backup_restore_cmvobsvr1mum'; my @arr= 
($str=~/(.+)_(.+)/); print join "\n",@arr,"\n";'
cs_backup_restore
cmvobsvr1mum
Ajay>

Thanks,
Ajay
-----Original Message-----
From: Xavier Noria [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 19, 2006 1:33 PM
To: Perl Beginners
Subject: Re: split function


On Jul 19, 2006, at 9:57, Sayed, Irfan ((Irfan)) wrote:

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

Which is the criteria, everything up to the last underscore?

-- fxn




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



--
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