On Sun, 2007-07-08 at 22:27 +0530, kilaru rajeev wrote: 
> Hi,
> 
> Please explain me whats wrong with the following code as it is
> respondingwith the some errors.
> 
> #!/usr/bin/perl -w
> use strict;

# Since you are use strict you must declare all variables before using #
them.  This prevents typos.

my ($var1, $var2);

> $var1 = 'Hello World'; # always wanted to do that :-)
> $var2 = "$var1\n";
> print $var2;
> exit;
> 
> output:
> Global symbol "$var1" requires explicit package name at sample.pl line 3.
> Global symbol "$var2" requires explicit package name at sample.pl line 4.
> Global symbol "$var1" requires explicit package name at sample.pl line 4.
> Global symbol "$var2" requires explicit package name at sample.pl line 5.
> Execution of sample.pl aborted due to compilation errors.
> 
> Thanks,
> Rajeev Kilaru
-- 
Ken Foskey
FOSS developer


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to