Think about Loose Coupling | |
PerlMonks |
Re: question on declaring variablesby toolic (Bishop) |
on Nov 22, 2018 at 12:03 UTC ( [id://1226177]=note: print w/replies, xml ) | Need Help?? |
Yes, the declaration is the same for both files, but $a is a special variable, whereas $x and $y are not. You get the error messages because you correctly use strict:
Because of their special use by sort(), the variables $a and $b are exempted from this check.You should avoid using $a and $b because they are special for the sort function. As the helpful message reports, you need to declare x and y with my.
In Section
Seekers of Perl Wisdom
|
|