in reply to Error msg "requires explicit package name"

sauoq and webfiend give you what's usually the best answer, to make the variable lexical with my.

Other ways are our $counter; which produces a scoped global, use vars '$counter'; which adds its argument list to the current namespace, or always referring to $counter as $main::counter (perhaps) which is the literal cure to the strict complaint, but awkward.

After Compline,
Zaxo

  • Comment on Re: Error msg "requires explicit package name"

Replies are listed 'Best First'.
Re: Re: Error msg "requires explicit package name"
by Theo (Priest) on Jun 17, 2003 at 02:54 UTC
    (Drat! I knew I was forgetting things)
    This covers questions from the first 3 replies.
    The first line of code displayed was line 16. The only non-comment lines before line 16 was the following:
    use strict; my @filenames = @ARGV;
    The version of the script before the one I posted did use the 'my' construct and it failed the same way.