develooper Front page | perl.beginners | Postings from May 2008

Re: comparing kit names

Thread Previous | Thread Next
From:
Gunnar Hjalmarsson
Date:
May 7, 2008 04:55
Subject:
Re: comparing kit names
perl_learner wrote:
> On May 6, 10:08 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
>> perl_learner wrote:
>>> 
>>> my @kits = $KIT_LIST;
>>
>> How many elements do you think there are in @kits?
>
> I have ~100 elements @kits. Why did you ask this question?

Because when you just said

     my @kits = $KIT_LIST;

you had only one element in @kits.

>>      my @kits = split ' ', $KIT_LIST;
> 
> Also with little change, "my @kits = split '  ', $KIT_LIST; ## added
> an extra space to split"
> 
> I am getting the desired output.

The extra space should not make a difference, since split(' ') is a 
special case that splits on all kinds of whitespace.

     perldoc -f split

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Thread Previous | Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About