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

Write an expression or perl script to identify the entered ip address is valid or not?

5 Answers   HCL,


Elaborate on perl bite-wise operators.

0 Answers  


What happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }' ?

0 Answers  


What does last statement do in perl?

0 Answers  


What can be done for efficient parameter passing in perl? Explain.

0 Answers  






How do I send e-mail from a Perl/CGI program on a Unix system?

0 Answers  


How do I replace every TAB character in a file with a comma?

0 Answers  


How will you get the count of parameters passed to a perl subroutine?

0 Answers  


What purpose does each of the following serve: -w, strict, - T ?

2 Answers  


Which web site will help the student to download the Java mini Project ?

3 Answers  


What are the functions that can be performed using cgi program?

0 Answers  


Explain chop?

0 Answers  


Categories