--- "McCormick, Rob E" <[EMAIL PROTECTED]> wrote:
>
> I'm trying to understand an example from the Waite Press book (Perl 5
> Interactive Course, a bit dated, '97, Orwant) The example doesn't
> have -w or strict; enabled. I ran it with them and the error
follows:
>
> #!c:/perl/bin/perl -w
> u
Line 9 says
else { $num * 3; $num++; }
The expression "$num * 3" is in a void context. In other words, it
calculates a value, but doesn't assign that value to anything. I think the
most likely typo is a missing equals sign:
else { $num *= 3; $num++; }
^
This would
The void context means that you're doing something that does nothing useful.
$num * 3;
Takes the value of $num, multiplies it by 3 and then trows the result
away, leaving $num unchanged. I think you want *= like this:
use strict;
print "Please type an integer: ";
chomp( my $num = );
while(