Explain the difference between my and local?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List all the features of perl programming?

513


What's the difference between /^Foo/s and /^Foo/?

553


What is the function of virtual documents in cgi programs?

528


Explain string comparison operators in perl.

556


Which functions in perl allows you to include a module file. State their differences.

529






What does `$result = f() .. g()' really return?

571


What is the difference between localtime() and gmtime() functions?

547


How can you create anonymous subroutines?

547


Which operator in perl is used for the concatenation of two strings?

499


Explain perl. When do you use perl for programming?

451


what is the function that is used to identify how many characters are there in a string?

541


explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.

462


Write a program to decode the data in the form using cgi programming

547


How do I sort a hash by the hash value?

557


Explain the different types of data perl can handle.

493