Rob Dixon wrote:
> Matthew Whipple wrote:
>>
>> The for loop won't execute if it has nothing through which to
>> iterate. On my system the for won't execute with an empty list, but
>> will once
>> when the array is undefined.  Changing the above to 'if
>> (defined(@DirContent)) {' would be a bit clearer.
>
> Now what would you mean by an array being undefined? If you write
>
>   @a = undef;
>
That's what I had done, my mistake.  I don't use it but I didn't know it
was wrong and was speculating that it may be used as a return value from
some functions (apparently just poorly written ones). 
> you have assigned the single-element list (undef) to @a, which I
> wouldn't call being undefined. To empty an array you must write
>
>   undef @a;
>
> or
>
>   @a = ()
>
> Even then it's stretching it a bit to say that the array is 'undefined',
> but at least there's nothing in it!
>
> HTH,
>
> Rob
>
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to