in reply to Use of Carp outside of package won't compile...

My dim understanding of the issue is that the package Test declaration introduces the “‘Package’ namespace.”   Prior to that point, the default package-name (which is main) was in effect.

The qw() statement exposes these variables into the “then-current” namespace... which changed mid-stream.

(Post edited as suggested by ikegami. Thx.)

Replies are listed 'Best First'.
Re^2: Use of Carp outside of package won't compile...
by Fletch (Bishop) on Dec 18, 2007 at 17:09 UTC

    Erm, no. qw() is just a special form of quoting (see perlop on "Quote-like Operators") and has nothing to do with the exporting of subs. The calling of the loaded module's import method by use is what's making things visible in the current package name space, and it would work just the same had he said use Carp 'croak' or use Carp q/croak/. It's just convention to use some variant of qw// because it allows you to easily specify a list of names to be imported with one set of delimiters.</pedant>

    Update: Added link and remark on quote-like ops.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.