June 29th, 2013, 07:53 PM
Using numerical operation in the format Add: 7
Please help me. I have the following in my text pad
$a = 5;
$c = $a + $b;
and the message I got while trying to run the program is
(Global symbol "$c" requires explicit package name at line 3)
June 29th, 2013, 08:07 PM
Please post your entire script.
The error message indicates that you're using the strict pragma, which is good. The strict pragma requires you to declare your vars, which is normally done with the 'my' keyword.
$a and $b are built-in global vars and don't need to be declared. Normally, they are reserved for use in sort routines, so using them as you are doing is not a recommended best practice.
June 30th, 2013, 02:40 AM
You might try this:
my $aa = 5;
my $bb =2;
$c = $aa + $bb;
Last edited by Laurent_R; June 30th, 2013 at 03:44 PM.
Reason: Corrected a typo
June 30th, 2013, 01:08 PM