in reply to Re: Differences between Perl 5.8 and Perl 5.18.2
in thread Differences between Perl 5.8 and Perl 5.18.2
I have the following errors:#!/usr/bin/perl -w $im_thinking_of=int(rand10); print "Pick a number:"; $guess=<STDIN>; chomp $guess; if ($guess>$im_thinking_of) { print "You guessed too high!\n"; } elsif ($guess < $im_thinking_of) { print "You guessed too low!\n"; } else { print "You got it right!\n"; }
Furthermore, it always gives me the answerArgument "rand10" isn't numeric in int at guess line 3
It is like it never reads elsif or else. This is only one example. I have other programs that have mistakes as well and it is not even my code. When I say that I copy and paste them, I mean that I read them from the book and write them again identically in my text editor.You guessed too high!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Differences between Perl 5.8 and Perl 5.18.2
by toolic (Bishop) on Apr 20, 2015 at 20:34 UTC | |
by mbgbioinfo (Novice) on Apr 21, 2015 at 18:18 UTC | |
by Laurent_R (Canon) on Apr 21, 2015 at 18:59 UTC |