what is the procedure to define a user define module in your
perl application?

Answer Posted / nachikethas

Create a .pm file eg xyz.pm and you can have subroutines or
what ever you want can be placed there.

#content of xyz.pm
package xyz;
sub Printit{
print "In module xyz...";
}
1;
#end of xyz.pm

for using this perl module in ur perl program eg abc.pl

# content of abc.pl

use xyz;
xyz->Printit();

#end pf abc.pl

hope this helps :)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does cgi program store?

544


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

529


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

533


What are perl variables?

530


How to convert strings into an array in perl?

519






Hi, I am a accountant. I am preparing a balance sheet but because of staff shortage and time pressures I cant complete it on time. There is lot of common data with last years which I need not retype and I can manage by editing last year’s balance sheet ? Is their any software on net where I can do this easily??

1763


Define dynamic scoping.

508


How to dereference a reference?

566


What are scalar data and scalar variables?

638


What are numeric operators in perl?

548


What does next statement do in perl?

585


Differences between die and exit.

623


What are the various flags/arguments that can be used while executing a perl program?

467


Why is it hard to call this function: sub y { "because" } ?

541


what are steps to do to lock the sony ericsson mobile with password?

1816