Explain the difference between die and exit in perl?



Explain the difference between die and exit in perl?..

Answer / Mahfooz Ali

In Perl, both `my` and `local` are used to declare variables with a limited scope. The main difference lies in their lifetime:

* `my` variables are declared within the current lexical scope (subroutine or block). They retain their value across function calls.
* `local` variables are declared within the current dynamic scope (subroutine call). Their lifetime ends when the subroutine returns.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

You want to connect to sql server through perl. How would you do that?

1 Answers  


what is perl language?

1 Answers  


Try pattern matching for the following: 1) 10.111.23.11 2) /root/abc/cde/fgg/ac.xml --> Get file name without extention. 3) /root/abc/ac.xml/fgg/ac.xml --> Get file name without extention. 4) What does "DIE" meant in PERL? 5) chomp 6) "This is saturday" --> Print the weekday number. 7) 11-2-2009 --> Print the name of the month. 8) Reverse the string without using func in C.

2 Answers  


Comment on data types and variables in perl.

1 Answers  


how to install a package in perl ????

2 Answers  


Define say() function in perl?

1 Answers  


What are the features of perl language?

1 Answers  


What is a chomp() function in perl?

1 Answers  


Write a script to reverse a string without using perl's built in functions?

1 Answers  


Explain returning values from subroutines?

1 Answers  


Explain substr function in perl?

1 Answers  


Explain splicing of arrays?

1 Answers  


Categories