Thanks, but what does "My" mean and why did you use "print" twice in a row?

Joel

----- Original Message ----- 
From: "Dan Muey" <[EMAIL PROTECTED]>
To: "Joel" <[EMAIL PROTECTED]>; "perl" <[EMAIL PROTECTED]>
Sent: Tuesday, February 17, 2004 5:15 PM
Subject: RE: Why does this keep happening?



> I'm running perl under windows XP and I keep geting this error:
>
> syntax error at (Directory and filename) Line 6, near " )
> {"
> syntax error at (directory and filename) line 9 near "}"
>
> The source code is below, but this happens with loops in
> general. Any ideas?
>
> ------------------------------------------------
> #!usr/bin/perl
>
> $a=1000

NO semi colon here for one, plus $a and $b are special sometimes so I'd
avoid those.

Try this:

#!/usr/bin/perl

use warnings;
use strict;
# always a good idea and very helpful to keep you sane!

my $cnt = 1000;

until ($cnt == 0) {
print print "Counting down to 0 from $cnt";
$cnt--;
}
print "Blast off!";

>
> until ($a==0)
> {
> print "Counting down to 0 from $a";
> $a--;
> }
> else (print "Blast off!")

This else needs an if to match I believe, perhaps not but it would make lots
more sense.


HTH

Dmuey
>
> Joel
>
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to