Front page | perl.beginners |
Postings from May 2008
Re: comparing kit names
Thread Previous
|
Thread Next
From:
Gunnar Hjalmarsson
Date:
May 7, 2008 13:08
Subject:
Re: comparing kit names
John W. Krahn wrote:
> Gunnar Hjalmarsson wrote:
>> perl_learner wrote:
>>> On May 6, 10:08 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
>>>>
>>>> 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.
>
> The extra space *does* make a difference:
>
> $ perl -le'$_ = qq[abc\t \t \t\tdef]; print ">$_<" for split q[ ]; print
> ">$_<" for split q[ ]'
> >abc<
> >def<
> >abc def<
Ouch! I should have tested before saying that...
But then it's hard to understand that the OP gets the desired output
with the extra space.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
Thread Previous
|
Thread Next