Explain the difference between my and local?
Answers were Sorted based on User's Feedback
Answer / mahendra ratnakar
The variables declared with "my" can live only within the
block it was defined and cannot get its visibility
inherited functions called within that block, but one
defined with "local" can live within the block and have its
visibility in the functions called within that block.
Is This Answer Correct ? | 12 Yes | 4 No |
Answer / sourisengupta
You can consider "my" as local and "local" as global
variable like C,C++.
The scope of "my" lies between the block only but if we
declare one varable global then we can asccess that from
the outside of the block also.
Is This Answer Correct ? | 2 Yes | 7 No |
What are scalars in perl?
Differentiate between use and require, my and local, for and foreach and exec and system
How to sort dates in Perl ?
Can we load binary extension dynamically?
How would you replace a char in string and how do you store the number of replacements?
Comment on the scope of variables in perl.
How and what are closures implemented in perl?
How do you find the length of an array?
How can you replace the characters from a string and save the number of replacements?
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?
What can be done for efficient parameter passing in perl?
What?s your favorite module and why?