Home
Perl
Array
CGI
Class
Data Type
Database
File
GUI
Hash
Language Basics
Network
Regular Expression
Report
Statement
String
Subroutine
System Functions
Win32
XML
Menu
Variable Scope « Language Basics « Perl
Perl
Language Basics
Variable Scope
1.
Auto local variable
2.
Local element
3.
Local variables.
4.
Forward Reference
5.
Uses the same name inside and outside a foreach statement.
6.
Creates a global variable $myvar and prints out the global instance of the variable and the package-specific variable:
7.
Scope of Variables: Variables used in subroutines are global by default