jcpunk has asked for the wisdom of the Perl Monks concerning the following question:
I was thinking, that if looks kinda nasty, so I went forif ( not $error ) { while ($a < $b) { $a++; } }
As I find that to look much better, but I get the following error message telling me that this does not work.while ($a < $b) if not $error { $a++; }
syntax error at testcondition.pl line 62, near ") if" Global symbol "%error" requires explicit package name at proxy.pl line 63. syntax error at testcondition.pl line 69, near "}"So, am I stuck with that rather ugly looking set of lines or is there a more beautiful replacement than
if ( not $error ) { while ($a < $b) { $a++; }}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: backwards if and while looping
by Grygonos (Chaplain) on Oct 01, 2004 at 19:51 UTC | |
|
Re: backwards if and while looping
by blokhead (Monsignor) on Oct 01, 2004 at 20:35 UTC | |
by Forsaken (Friar) on Oct 02, 2004 at 10:20 UTC | |
|
Re: backwards if and while looping
by ikegami (Patriarch) on Oct 01, 2004 at 20:40 UTC | |
|
Re: backwards if and while looping
by periapt (Hermit) on Oct 01, 2004 at 19:55 UTC | |
by jcpunk (Friar) on Oct 01, 2004 at 20:20 UTC | |
by BrowserUk (Patriarch) on Oct 01, 2004 at 22:44 UTC | |
|
Re: backwards if and while looping
by cLive ;-) (Prior) on Oct 01, 2004 at 19:58 UTC | |
|
Re: backwards if and while looping
by !1 (Hermit) on Oct 01, 2004 at 22:16 UTC | |
by Zed_Lopez (Chaplain) on Oct 01, 2004 at 23:18 UTC | |
by !1 (Hermit) on Oct 02, 2004 at 00:28 UTC | |
by Zed_Lopez (Chaplain) on Oct 02, 2004 at 05:27 UTC | |
|
Re: backwards if and while looping
by johnnywang (Priest) on Oct 01, 2004 at 19:56 UTC | |
|
Re: backwards if and while looping
by talexb (Chancellor) on Oct 01, 2004 at 21:39 UTC |