How can you create anonymous subroutines?



How can you create anonymous subroutines?..

Answer / Arti Kumari

"Anonymous subroutines (also known as closures) in Perl can be created using the 'sub' keyword without a name. For example, my $closure = sub { print 'Hello from closure!'; }"

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

What is stdin in perl?

1 Answers  


How does polymorphism work in perl? Give an example.

1 Answers  


What is qq (double q)operator in perl?

1 Answers  


What are arrays in perl?

1 Answers  


Which functions in Perl allows you to include a module file or a module and what is the difference between them?

1 Answers  


You want to print the contents of an entire array. How would you do that?

1 Answers  


Why do you use only Perl when there a lot of more languages available in market like C, Java?

1 Answers  


What is the difference between having a parenthesis after module name and without parenthsis after module name?? i.e Package::Module(); and Package::Module;

1 Answers  


How to print escaping characters inside a string in perl?

1 Answers  


How to close a directory in perl?

1 Answers  


What are the various advantages and disadvantages of perl?

1 Answers  


Comment on array slicing and range operator

1 Answers  


Categories