use vars

use vars qw($frobbed @munge %seen);

This pragma, once used to declare a global variable, is now somewhat deprecated in favor of the our modifier. The previous declaration is better accomplished using:

our($frobbed, @munge, %seen);

or even:

our $frobbed = "F";
our @munge = "A" .. $frobbed;
our %seen = ();

No matter which of these you use, remember that they're talking about package globals, not file-scoped lexicals.

Get Programming Perl, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.