perlquestion
badbanana
i have this two files below. the first one produces no errors but the second one produces the following errors:
<p>
Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at ./two.pl line 6.<br>
Global symbol "$y" requires explicit package name (did you forget to declare "my $y"?) at ./two.pl line 7.<br>
Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at ./two.pl line 10.<br>
Global symbol "$y" requires explicit package name (did you forget to declare "my $y"?) at ./two.pl line 13.<br>
Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at ./two.pl line 15.<br>
Global symbol "$y" requires explicit package name (did you forget to declare "my $y"?) at ./two.pl line 15.<br>
Execution of ./two.pl aborted due to compilation errors.<br>
</p>
this is file 1:
<code>
#!/usr/bin/perl
use warnings;
use strict;
$a=0;
chomp($a=<STDIN>);
print $a, "\n";
</code>
and this is file 2:
<code>
#!/usr/bin/perl
use warnings;
use strict;
$x=0;
$y=0;
print "enter first number ";
chomp($x=<STDIN>);
print "enter second number ";
chomp($y=<STDIN>);
print "Product ",$x*$y, "\n";
</code>
i can't seem to figure out what's causing the errors for file 2. the declaration is the same in both files.