Tuesday, September 13, 2011

What is the difference between @EXPORT and @EXPORT_OK in Perl?

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace. @Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.
@EXPORT_OK does export of symbols on demand basis for selective list of symbols (subroutines and variables) of the module.

No comments :