Re: comparing kit names

[email protected] ("John W. Krahn")
Newsgroups perl.beginners
Message-ID <[email protected]>
Gunnar Hjalmarsson wrote:
> perl_learner wrote:
>> On May 6, 10:08 am, [email protected] (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<



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.