> > Get in the habit of using strict and warnings -- 'use warnings' is
> > subtly different from 'perl -w' and you should start good habits
> > early. Upgrade if you are using an ancient version of Perl that does
> > not come with warnings.
> >
> So would it be a conflict to use both "-w" and "st
Danny wrote:
> Hi list,
Hello,
> Hope this is not too simple or a stupid question:
>
> I have a slight problem with a loop. It is a simple numbers guessing game. It
> works fine, but when I run this script, it gives me "Too low" immediately
> after
> the prompt. What should I do to get the last
On Wed, 2006-31-05 at 20:03 +0200, Danny wrote:
> > Get in the habit of using strict and warnings -- 'use warnings' is
> > subtly different from 'perl -w' and you should start good habits
> > early. Upgrade if you are using an ancient version of Perl that does
> > not come with warnings.
> >
> So
> >
> > #!/usr/bin/perl
> > use strict;
> > use warnings;
> >
> > our ($upper, $lower, $target) = ( 20, 1, 11 );
> >
>
> D'oh! I really _meant_ to make those lexical instead of package
> variables - another good habit to get in early.
>
> my ($upper, $lower, $target) = (20,1,11);
>
Will do (p
> Here's one way to accomplish what you want, and it eliminates some of
> the redundancy. BTW, get used to using strict. It really does help in
> the long run and it's better to learn it early than to decide to go back
> later and fix your old programs.
>
I am making it a habbit now. Thank you v
> Get in the habit of using strict and warnings -- 'use warnings' is
> subtly different from 'perl -w' and you should start good habits
> early. Upgrade if you are using an ancient version of Perl that does
> not come with warnings.
>
So would it be a conflict to use both "-w" and "strict"?
Dann
Hi list,
Thank you all who responded to my question and in particular Dr MindHacker.
After I saw the
corrected code, I realized how I am supposed to "think" in perl.
Thank you very much.
Danny
>
> Danny,
>The code is below, I ran a simple test and
> it worked. The "Please choose ..." p
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> our ($upper, $lower, $target) = ( 20, 1, 11 );
>
D'oh! I really _meant_ to make those lexical instead of package
variables - another good habit to get in early.
my ($upper, $lower, $target) = (20,1,11);
--
To unsubscribe, e-mail: [EMAIL
> Hi list,
>
> Hope this is not too simple or a stupid question:
>
> I have a slight problem with a loop. It is a simple numbers guessing game. It
> works fine, but when I run this script, it gives me "Too low" immediately aft
> er
> the prompt. What should I do to get the last "else" statement d
On Wed, 2006-31-05 at 17:58 +0200, Danny wrote:
> Hi list,
>
> Hope this is not too simple or a stupid question:
>
> I have a slight problem with a loop. It is a simple numbers guessing game. It
> works fine, but when I run this script, it gives me "Too low" immediately
> after
> the prompt. Wha
Here's one way to accomplish what you want, and it eliminates some of
the redundancy. BTW, get used to using strict. It really does help in
the long run and it's better to learn it early than to decide to go back
later and fix your old programs.
###
#!/usr/bin/p
11 matches
Mail list logo