Explain the default scope of variables in perl?
Answer / Kumar Abhineet
In Perl, variables are scoped by lexical or dynamic context. Lexical variables are declared using my and have package level scope (defaulting to the current package). Dynamic variables (also known as global variables) don't have an explicit declaration and have file or subroutine scope. If a variable is used without being declared, it is treated as a dynamic variable.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to read a file into a hash array?
How to copy a file in perl?
What is the use of -n and -p options?
Explain 'grep' function.
what is the main function of fork() in cgi programming?
Why is it hard to call this function: sub y { "because" } ?
Does Perl have reference type?
Explain the difference between declarations of 'my' and 'local' variable scope in perl?
How does polymorphism work in perl?
How interpreter is used in perl?
What does the qq{ } operator do?
sort a word "system" in perl/shell without using built in functions output should be emssty