SPUG: interesting while() behavior and hosting recs

John W. Krahn krahnj at telus.net
Sun Oct 3 06:09:32 CDT 2004

Yitzchak Scott-Thoennes wrote:
> On Fri, Oct 01, 2004 at 10:46:36AM -0700, Tim Maher wrote:
>>As a case in point, I offer the widespread notion that parens
>>function as "list constructors" in expressions like
>>"@array=(1,2)" and "print (1,2)", which is tremendously useful,
>>despite being less than a perfectly accurate representation of
>>how those expressions are actually parsed and evaluated, IIRC.
>>(What's the real story? Is it that the comma operator in list
>>context returns all the expressions, so the parens are just there
>>for reasons of precedence in the case of an assignment?)
> They are just there for reasons of precedence.  Parens really really
> really truly don't function as list constructors.

So in the expressions:

while ( () ) { print "this won't print\n" }

$count = () = $string =~ /\d+/g;

You are saying that there is no list?

use Perl;

More information about the spug-list mailing list