Home arrow Perl Programming arrow Page 3 - Introduction to mod_perl (part 4): Perl Basics

Making Variables Global With strict Pragma On - Perl

Now that you have mod_perl installed, you can move on to learning how to use it. This article will run you through some basic Perl concepts to start with.

TABLE OF CONTENTS:
  1. Introduction to mod_perl (part 4): Perl Basics
  2. Using Global Variables and Sharing Them Between Modules/Packages
  3. Making Variables Global With strict Pragma On
  4. Using Exporter.pm to Share Global Variables
  5. Using the Perl Aliasing Feature to Share Global Variables
  6. Using Non-Hardcoded Configuration Module Names
  7. The Scope of the Special Perl Variables
  8. Compiled Regular Expressions
  9. References
By: Stas Bekman
Rating: starstarstarstarstar / 6
January 03, 2003

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

First you use :

use strict;

Then you use:

use vars qw($scalar %hash @array);

This declares the named variables as package globals in the currentpackage. They may be referred to within the same file and packagewith their unqualified names; and in different files/packages withtheir fully qualified names.

With perl5.6 you can use the our operator instead:

our qw($scalar %hash @array);

If you want to share package global variables between packages, hereis what you can do.



 
 
>>> More Perl Programming Articles          >>> More By Stas Bekman
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PERL PROGRAMMING ARTICLES

- Perl Turns 25
- Lists and Arguments in Perl
- Variables and Arguments in Perl
- Understanding Scope and Packages in Perl
- Arguments and Return Values in Perl
- Invoking Perl Subroutines and Functions
- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: