jcassie420,
Welcome to the Monastery. Please have a look at Writeup Formatting Tips. It appears your entire question is in code tags, but only the code should be.
In answer to your question, see here:
sub more { print "more()\n" }
sub fallover { print "fallover()\n" }
print "Welcome to johns fun house\n";
print " : ";
my $command=<>;
chomp $command;
if ($command eq "fun") {
more;
}
if ($command eq "laugh") {
fallover;
}
The first important change is to us "eq" when comparing strings. The "==" comparison is only for numbers. See perlop for details.
The other important change is to chomp the input after you get it. Otherwise, $command will have a trailing line terminator.
As an aside, if you haven't looked into them already, I recommend you use strict and warnings with everything you write. You may want to go without them later, but for now they'll probably save you more headaches than they cause. |