in reply to Re^6: pattern matching with wildcards...
in thread pattern matching with wildcards...

Download the module from CPAN, extract it and copy-and-paste it at the end of your script. You will not have to "use" it as it is already in your script. By putting it at the end of your script its package declaration will not interfere with your namespace.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

  • Comment on Re^7: pattern matching with wildcards...

Replies are listed 'Best First'.
Re^8: pattern matching with wildcards...
by almut (Canon) on May 12, 2009 at 21:55 UTC

    It's also usually a good idea to put a BEGIN { ... } block around the module's inlined code...

    Try to run the following demo snippet without the BEGIN block to see why:

    #!/usr/bin/perl use strict; use warnings; Some::Module->import qw(foo); # instead of "use Some::Module qw(foo); +" my $var = "foo"; print foo(),"\n"; # --- inlined module --- BEGIN { package Some::Module; use strict; use warnings; use Exporter "import"; our @EXPORT_OK = qw(foo); my $var = "init-value"; sub foo { return $var; } } # end of BEGIN