Perl-defined variables are global by default
1) My role: the name and value of the variable are limited to a range, that is, the variable can only be the module or function
You can see this variable, a layer or a lower layer is not visible.
2 Our role: To limit the variable name to a range, in fact, is to explicitly declare a "global variable", although it is in a
Modules or functions inside the definition, the outside can also be accessed, if it has been declared, again with our, express here and previously declared our variables
is the same one.
3 Local role: The value is limited to a certain range, which differs from my, which includes this layer and the lower level of this layer,
However, the previous layer of this layer is not accessible.
4) Global Variables
Use VARs QW ($szVersionCode, $szVersionNmae) to define variables $szversioncode and $szversionname
into global variables. Its role and our role is equal. Because of its presence in my presence, our previous period of history, so that we can now
See some books on the definition of global variables also continue this definition method, but I suggest: Define global variables or use our keyword to define.
PS: When Perl is not using use strict ' vars ', we can use any variable without the need to implement the definition.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.