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;
>
> 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!
>
Actually, after testing perl behavior again today, it's not even doing
what I had said it did.  I don't know what I did yesterday.  I must have
mixed up the right and the wrong way enough to make me think it worked.
> HTH,
>
> Rob
>
>


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


Reply via email to