On 9/19/07, David Totten <[EMAIL PROTECTED]> wrote: > On 9/19/07, Stephane Legault <[EMAIL PROTECTED]> wrote: > > 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. > > you should be able to change that a little and do ($x,@y)=split(/:/) >
Now that I have a computer with perl installed on it, I have tested this: #!/usr/bin/perl -w use strict; my $list = "sample1:sample2:sample3:sample4:sample5"; my $first = ""; my @rest = (); ($first,@rest) = split(/:/,$list); print "$first\n$rest[0]\n$rest[1]\n"; and the output is: sample1 sample2 sample3 _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
