Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Did sir forget his underscore?

    And, out of interest, do you use @methods anywhere else? Looks like a useless use of variable to me. [qw/.../] is perfectly fine...
    • Re:Oops (Score:3, Interesting)

      Oh goody. You're going to slap yourself :)

      The first thing you do is create a file named "":

      package Foo;

      sub import { print "@_" }


      Then, in the same directory, run the following script:

      #!/usr/local/bin/perl -w
      use strict;

      BEGIN { unshift @INC => '.' }
      my @methods = qw/bar baz/;
      use Foo @methods;

      That prints "Foo". Foo's import method gets called with no arguments because the assignment to @methods happens after the use statement, even though strict does not complain because @methods has al