Explain the difference between my and local?

Answers were Sorted based on User's Feedback



Explain the difference between my and local? ..

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

Explain the difference between my and local? ..

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

Post New Answer

More CGI Perl Interview Questions

What is the use of "stderr()"?

0 Answers  


How can you replace the characters from a string and save the number of replacements?

0 Answers  


Explain about the applications of perl?

0 Answers  


How to access parameters passed to a subroutine in perl?

0 Answers  


Explain the meaning of closure in perl.

0 Answers  






What is the difference between $array[1] and @array[1]?

1 Answers  


How many data types are there in perl?

0 Answers  


What is an interpolation in perl?

0 Answers  


What are arrays in perl?

0 Answers  


What are the different string manipulation operators in perl?

0 Answers  


What are the various file operations in perl. Explain with example.

0 Answers  


how to find a substring in a string without using substr built in functions, and print the substring found

3 Answers   Nokia,


Categories