Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Including files

by Juerd (Abbot)
on Sep 24, 2004 at 09:28 UTC ( #393426=perltutorial: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    use lib 'path/to/the/modules';
    # The example module could be path/to/the/modules/NameOfTheProject/Som
  2. or download this
    use strict;
    package NameOfTheProject::SomeModule;
  3. or download this
    use NameOfTheProject::SomeModule;
    print NameOfTheProject::SomeModule::some_function();  # prints 123
  4. or download this
    use base 'Exporter';
    our @EXPORT_OK = ('some_function');
  5. or download this
    use NameOfTheProject::SomeModule ('some_function');
    print some_function();  # prints 123
  6. or download this
    # This is
    mirror     => '',
    path       => '/var/www/example',
    skip_files => [ 'png', 'gif', 'jpg' ],
  7. or download this
    # This is
    use strict;
    chdir $config{path};
  8. or download this
    use strict;
    package Acme::Include;
  9. or download this
    # This is
    use strict;
    include '';
    print $lexical;  # Should print: set in
  10. or download this
    # This is
    use strict;
    # There is no "my" here, because that would create a *new* lexical
    # variable, hiding the existing one.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://393426]
[marioroy]: why do some posters not know to provide a good SSCCE? Nested loops?
[Corion]: marioroy: Producing good SSCCE is an acquired skill :) You have to produce bad SSCCEs for a long time until you get good. And when you get good, you don't need them that much anymore because you simply isolate the problem and then solve it ;)
[marioroy]: ... and kcott is able to provide something. Amazing.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2017-08-18 08:13 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (297 votes). Check out past polls.