Demonstrate subroutines in perl with a simple example.



Demonstrate subroutines in perl with a simple example...

Answer / Avnish Bharadwaj

Subroutines are functions in Perl. To define a subroutine, use the sub keyword.nnExample: `sub greet { print 'Hello, World!'; } greet();` This defines a subroutine called 'greet' and then calls it.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

Explain the meaning of closure in perl.

1 Answers  


What are the various advantages and disadvantages of perl?

1 Answers  


Distinguish my and local?

1 Answers  


Explain lists ?

1 Answers  


Can inheritance be used in perl?

1 Answers  


what is Perl one liner?

1 Answers  


Mention how many ways you can express string in Perl?

1 Answers  


What is the difference between module and package?

4 Answers   EDS, IBM, Symantec,


Explain what is the scalar data and scalar variables in Perl?

1 Answers  


I have one question regarding to eval function. I know eval function is use for error checking but I am not able to understand below line. eval \'exec perl -S $0 ${1+\"$@\"}\' if 0; $0 for script name $@ set if error occur

1 Answers  


How can you replace the characters from a string and save the number of replacements?

1 Answers  


What are the different ways to run cgi?

1 Answers  


Categories