home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book Home Programming PerlSearch this book

31.21. 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.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.