What happens when you return a reference to a private variable?



What happens when you return a reference to a private variable?..

Answer / Sonam Khampa

When you return a reference to a lexical (private) variable, it is still in-scope and maintains its value. However, the returned reference may not be what you expect if the variable is redefined or destroyed before the function returns.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

There is no strict data types in perl unlike in other high level languages like Java so wouldn't that be a problem if a code in perl is to be a written by a big team of 20+ members ?"

0 Answers   Cisco, Oracle,


How do you debug a Perl scripting ( at the compile time error or run time error) in Unix environment ?

4 Answers  


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

1 Answers  


How can we create perl programs in unix, windows nt, macintosh and os/2 ?

1 Answers  


Why should I use the -w argument with my Perl programs?

1 Answers  


How to open a directory in perl?

1 Answers  


How to code in perl to implement the tail function in unix?

1 Answers  


You want to read command-line arguements with perl. How would you do that?

1 Answers  


What do the symbols $ @ and % mean when prefixing a variable?

1 Answers   Barclays,


Which feature of Perl provides code reusability ? Give any example of that feature.

1 Answers  


What is qq (double q)operator in perl?

1 Answers  


What happens in dereferencing?

1 Answers  


Categories