Why we use "use lib $path"?



Why we use "use lib $path"?..

Answer / guest

If we are trying to add a module or library files in our
program using require or use statement then it will search
that module or library files in the Perl's default search path.

The statement use lib is used to add the directories to
default search path.

So if the module or library file is not located in the
Perl's default search path then it will find the library
files in the path we have given with the use lib $path.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

How to do comment in perl?

1 Answers  


package MYCALC; use Exporter; our @EXPORT = (); our @ISA = qw(Exporter); our @EXPORT_OK = qw(addition multi); our %EXPORT_TAGS = (DEFAULT => [qw(&addition)],Both => [qw(&addition & +multi)]); sub addition { return $_[0] + $_[1]; } sub multi { return $_[0] * $_[1]; } 1; Program: use strict; use warnings; my @list = qw (2 2); use Module qw(:DEFAULT); print addition(@list),"\n"; Above coding is my module MYCALC and the program which using this module, I have not exported any function using @EXPORT, but I have used the DEFAULT in %EXPORT_TAGS with the function addition, when I call this function from the main it says the error as,

1 Answers  


What is -> symbol in perl?

1 Answers   HCL,


What is 'commit' command in perl?

1 Answers  


Explain which feature of PERL provides code reusability?

1 Answers  


You want to download the contents of a url with perl. How would you do that?

1 Answers  


How to concatenate strings with perl?

1 Answers  


What does 'do' statement do in perl?

1 Answers  


Write a script to reverse a string without using Perl's built in function

8 Answers   Nokia,


Explain perl. What are the advantages of programming in perl?

1 Answers  


How will you open a file in a write-only mode in perl?

1 Answers  


What is 'rollback' command in perl?

1 Answers  


Categories