SPUG: interesting while() behavior and hosting recs

Yitzchak Scott-Thoennes sthoenna at efn.org
Sun Oct 3 07:16:53 CDT 2004


On Sun, Oct 03, 2004 at 04:09:32AM -0700, "John W. Krahn" <krahnj at telus.net> wrote:
> Yitzchak Scott-Thoennes wrote:
>
> >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?

:)  For every rule, there's an exception; () is the exception here.

But it doesn't work by way of some grammatical rule that what's inside
() is a list; empty parens are handled in perl's grammar as a special
case.  I guess you could look at it as the parentheses being required
to delimit the empty list for which there is no other syntactic
provision.


More information about the spug-list mailing list