Ana Saiz García am Dienstag, 13. Februar 2007 13:02: > On 12/02/07, D. Bolliger <[EMAIL PROTECTED]> wrote: > > Ana Saiz García am Montag, 12. Februar 2007 22:26:
[snipp and following code stripped] > > #!/usr/bin/perl > > > > # don't forget: > > # > > use strict; > > use warnings; > > > > package A; > > sub hello { print "hello from A\n" } > > > > package main; > > > > my $pkg='A'; > > my $sub=\&{$pkg.'::hello'}; > > $sub->(); > > > > __END__ > > Hi again and thanks for your help > > Don't I have to put "use" and the name of packages A and B anywhere on the > main program? Not if the package declarations are in the same file as the main package; in most cases the modules are in separate files, and then 'use' is necessary to read, and compile the files with the module (package) definitions. See perldoc -f use. Therein is explained that 'use Module' is equivalent to BEGIN { require Module; import Module LIST; } perldoc -f require perldoc Exporter # defines the import() method mentioned above 'use' searches for modules in the paths defined in the @INC variable (see perldoc perlvar) which can be modified directly or (preferred) via the lib pragma: use lib '/some/path'; # see: perldoc lib regards, Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/