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

Then include the module as part of your script.

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^5: pattern matching with wildcards...

Replies are listed 'Best First'.
Re^6: pattern matching with wildcards...
by mikerzz (Acolyte) on May 12, 2009 at 18:56 UTC
    How would I include the module as part of the script? That sounds like the right road to travel down.
      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

        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
        Monks! Just wanted to say thanks to all who contributed a response to my question. I was able to complete this script with your help. I appreciate it. Mike R