Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!mailrus!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR/KT) Newsgroups: comp.lang.perl Subject: Re: do BLOCK bug? Message-ID: <1990Aug4.191755.10900@NCoast.ORG> Date: 4 Aug 90 19:17:55 GMT References: <1137@etnibsd.UUCP> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR/KT) Followup-To: comp.lang.perl Organization: North Coast Public Access *NIX, Cleveland, OH Lines: 29 As quoted from <1137@etnibsd.UUCP> by vsh@etnibsd.UUCP (Steve Harris): +--------------- | foo: { | /^abc/ && do { $abc = 1; last foo; } | /^def/ && do { $def = 1; last foo; } | /^xyz/ && do { $xyz = 1; last foo; } | $nothing = 1; | } | | syntax error in file t.pl at line 3, next token "/^def/" | syntax error in file t.pl at line 5, next token "$nothing" | Execution aborted due to compilation errors. | | The errors go away if I place a semicolon after each do BLOCK | (presumably the do BLOCK is expecting an optional modifier, e.g.:) +--------------- More precisely, you are using "do BLOCK" as an expression, and the complete expression needs a semicolon. (That is, the statement you are ending with a semicolon has as its "primary" operator not "do", but "&&".) Given that "do" can be used in this way, there's no way to get around the semicolon without uglifying the syntax description considerably. ++Brandon -- Me: Brandon S. Allbery VHF: KB8JRR/KT on 220 (soon others) Internet: allbery@NCoast.ORG Delphi: ALLBERY uunet!usenet.ins.cwru.edu!ncoast!allbery America OnLine: KB8JRR