This small piece of the Stats sub calculates the
speed at which you are traveling.
I have in the main program.
use stats

and I call on it just like a regular sub
Speed();
or should it be
stats::Speed;
????

When I call on the entire mod, i want the whole thing to run.
I could just put all the subs in the mod into one sub and call on that.. i
guess.

thanks
Lou

ps.. i know my coding sucks.. i'm a beginner....
its the best i can do given my understanding




########################
package stats;

sub BEGIN
{
   use Exporter();
   @ISA = qw(Exporter);
   @EXPORT = qw(Speed)
}

sub Speed
{
 $v0 = 1+$Army+$Hero+$Spy;
 $v1 = 1+$Army+$Hero+$Spy+$Wagon;
 if  ($Wagon < 1 && $Horse >= $v0
  && $Saddle >= $v0 && $Blanket >= $v0
  && $Load <= 100)
    {$Speed = "1.5";}
 elsif ($Wagon == 0 && $Horse >= $v0 && $Load <= 100)
    {$Speed = "2";}
 elsif ($Wagon > 0 && $Horse >= $v1 && $Load <= 100)
  {$Speed = "2.5";}
 elsif ($Wagon == 0 && $Load <= 100)
  {$Speed = "3";}
 elsif ($Load > 100)
  {$Speed = (int(.3 * $Load))/10;}
 else {$Speed=3;}
}
return 1;


#####################3



-- 
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