Thanks Jenda, Chas.Owens and fellow members.

What do you mean by "globalise"?
Jenda

Looking at the script below, in diagram 1, $capital will not be incremented unless I write it as in diagram 2. Just because I do not want $capital to be reset on each foreach loop, I then have to declare $capital as in diagram 2. This seems to defeat the purpose of using the "use strict" pragma.
Thanks


#####diagram 1#########
use strict;
my $banker = 5;
my $player = 3;
my $stake = 1;

foreach (qw/1..10/){
          if ($banker > $player){
          my $capital += $stake;
      }
}
#### diagram 2 ###########
use strict;
my $banker = 5;
my $player = 3;
my $stake = 1;
my $capital = 1;

foreach (qw/1..10/){
     if ($banker > $player){
          $capital += $stake;
     }
}




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


Reply via email to