Hi
I have a set of salaras as $a, $b etc..
Since I am using strict and warnings, how do I declare them. I am not initialising to any value. Is there any way to declare them instead of
my $a;
my $b;
...etc
Thanks.
If you have a list of variables to declare you can do this:
my ($var, @var, %var, $var2);
That packages them and you can then use them as needed. But don't get into the habit of just declaring all your variables at the beginning of a script, only declare them when and where needed, otherwise they are just global variables and that defeats the purpose of using lexical variables.
I think if you had read the strict pragmas documentation the list declaration is discussed. Try and get used to reading the documentation, it might be confusing sometimes but the more you read it the clearer it becomes.