perlquestion
Dipseydoodle
<p>
Hello Perlmonks. A while ago I began work on a Multi User Dungeon, but since then I have decided to cut out the "Dungeon" elements and go with a purely survival theme.</p>
<code>
#!/usr/bin/perl
use warnings;
if ($diff = easy){
$wood = 120;
}
elsif ($diff = hard){
$wood = 75;
}
if ($diff = easy){
$food = 50;
}
elsif ($diff = hard){
$food = 20;
}
$maxRNG = 6;
$RNG = rand($maxRNG);
NAME:
print "May I have your name please?\n";
chomp($name = <>);
print "Thank you $name.\n";
sleep 1;
system("clear");
goto DIFFICULTY;
DIFFICULTY:
print "Please enter a difficulty level: easy, or hard.\n";
chomp($diff = <>);
print "you chose $diff.\n";
sleep 1;
system("clear");
goto BEGIN;
BEGIN:
print "You have crash landed on a strange alien planet and must find a way to get back to earth.\n";
goto PTURN;
PTURN:
print "\n";
print "You have $wood wood and $food food.\n";
print "You can:\n";
if($wood = 10){
print "BUILD a HUT with 10 wood\n";
}
</code>
<p>
As you can see I have set the amount of $wood to a selection in $diff. But this is not working. When I run it, I enter hard and it keeps the amount at 120. What am I doing wrong?
</p>