At 01:27 PM 7/11/02 -0400, Shishir K. Singh wrote: > >I'm new to perl, but have a background in C. > > >Can someone tell me what is the difference between 'use' and > 'require'? When do you > >use one and not the other? Seems they both are comparable to a C > header file (.h). > > >Thanks in advance..... > >use is resolved during compile time whereas require is resolved during >run time(execution). >Use is analogous to using require within BEGIN { }. You can use >require anywhere in your code to do a lazy pull in of the required module.
A few additional items: 'use' calls 'import' on the module, which may do stuff (if the module inherits from Exporter, it may export names to the caller's package). Being called at compile time means that if the module exports subroutines with prototypes, they can be called without parentheses in the caller without warning. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]