对的啊,  ‘’ 也算元素 ,

$error[1] ='' ;  这已经算一个元素了
$error[1] = undef ;  也算



2009/12/15 joewu <[email protected]>

>
>
> 2009/12/15 Michael Zeng <[email protected]>
>
>
>> my @data = () ;
>>
>> #$data[0] = '' ;
>> #$data[1] = '' ;
>> if  ( @data ) { print @data ; }
>>
>> 用  if (  @data )  判断就可以了 ,  如...@data 里面有元素 (即使是空格),
>>
>> 那...@data > 0 ,  否则 == 0
>>
>>
>>
>> 2009/12/15 joewu <[email protected]>
>>
>>>
>>>
>>> 2009/12/15 joewu <[email protected]>
>>>
>>>
>>>>
>>>> 2009/12/15 Xiaojun Deng <[email protected]>
>>>>
>>>>   On Tue, Dec 15, 2009 at 11:39:15AM +0800, joewu wrote:
>>>>> >像这样:
>>>>> >my @array=();
>>>>> >$array[0]='';
>>>>> >$array[1]='';
>>>>> >$array[2]='';
>>>>> >有没有一个现成的方法判...@array是空的呢?
>>>>> >
>>>>>
>>>>> @array == 0
>>>>>
>>>>> >--
>>>>> >
>>>>> >您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>>>> >要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>>>> >要取消订阅此网上论坛,请发送电子邮件至 
>>>>> >[email protected]<perlchina%[email protected]>
>>>>> 。
>>>>> >若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>>> >
>>>>> >
>>>>>
>>>>> --
>>>>>  [32m题目:《元日》 [m
>>>>>  [33m作者:王安石(1021-1086) [m
>>>>> 爆竹声中一岁除,春风送暖入屠苏。
>>>>> 千门万户[日童][日童]日,总把新桃换旧符。
>>>>>
>>>>> --
>>>>>
>>>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>>>> 要取消订阅此网上论坛,请发送电子邮件至 
>>>>> [email protected]<perlchina%[email protected]>
>>>>> 。
>>>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>>>
>>>>>
>>>>> 不行的 @array返回的是数组的数量。my @array=();
>>>>
>>>> >$array[0]='';
>>>> >$array[1]='';
>>>> >$array[2]='';
>>>> @array是3
>>>>
>>>> 找了个办法my $string= jion("",@array); length($string)==0;
>>>
>>> --
>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>>> 要取消订阅此网上论坛,请发送电子邮件至 
>>> [email protected]<perlchina%[email protected]>
>>> 。
>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>>
>>
>>
>>
>> --
>>            Yours Sincerely
>>                    Zeng Hong
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
> my @error=();
> $error[1]='';
> $error[3]='';
> print 'ok' if(@error)
>
> 这样子测试的时候 发现不行啊
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 
> [email protected]<perlchina%[email protected]>
> 。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>



-- 
           Yours Sincerely
                   Zeng Hong

--

您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。


回复