split() has a third argument which specifies the maximum number of
pieces to split the string into.  So:

    ($first, $rest) = split /:/, $_, 2;

will do what you want.

Bonne chance,
Eric J. Roode

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Stephane Legault
Sent: Wednesday, September 19, 2007 9:16 AM
To: [email protected]
Subject: split question

Hi, I want split a list in two parts from the same delimiter character.
 
Here is the list [sample1:sample2:sample3:sample4:sample5]
 
I would like a $variable containing sample1 and another one containing
the rest.
 
I search a lot on Internet and find how to split this in many variable
($x,$y)=split(/:/) but this is not useful for me.
 
Does anyone can help?
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to