SPUG: interesting while() behavior and hosting recs

John W. Krahn krahnj at telus.net
Thu Sep 30 23:59:49 CDT 2004

DeRykus, Charles E wrote:
> An array (AV) can meaningfully be evaluated in scalar context so
> I'd expect @empty to fail. However, () is a list in scalar context 

As Randal has pointed out many times and as the FAQ clearly states:

perldoc -q "What is the difference between a list and an array"
        As a side note, there's no such thing as a list in scalar context.

> which doesn't behave in a predictable manner. 

That is because it doesn't exist.

In the expression:

while () { ... }

there is NO list.

As a side note, and has been recently discused on comp.lang.perl.misc, 
parentheses do not create a list.


use Perl;

More information about the spug-list mailing list