I think split can do that: ($x, $y) = split( /:/, $_, 2 );
http://perldoc.perl.org/functions/split.html -- Paul J. Brzezinski EDS - Integration Engineering Phone:+1-248-365-9615(8-355) P [EMAIL PROTECTED] >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:activeperl- >[EMAIL PROTECTED] On Behalf Of Thurn, Martin >Sent: Wednesday, September 19, 2007 9:26 AM >To: Stephane Legault; [email protected] >Subject: RE: split question > >Split can not do that. Use a regex such as > >my $sList = 'sample1:sample2:sample3:sample4:sample5'; >my ($s1, $s2) = ($sList =~ m!\A([^:]*):(.+)\Z!); >print "s1=$s1= s2=$s2=\n"; > > > - - Martin > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of >Stephane Legault >Sent: Wednesday, September 19, 2007 09:16 >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. >_______________________________________________ >ActivePerl mailing list >[email protected] >To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
