develooper Front page | perl.beginners | Postings from March 2002

the scope of BEGIN {}

Thread Next
Nikola Janceski
March 13, 2002 10:26
the scope of BEGIN {}
Message ID:
	if ($^O =~ /^(ms)?(win|dos)(32|nt)?$/i){
		eval q{ 
			use lib "N:/xxx/perl_lib";
			use Win32::Process;
			use Win32::Event 1.00 qw(wait_any);

			$follow = 0; # used in find command
			$follow_skip = 0; # used in find command

		} else {
		eval q{ 
			use lib "/xxx/perl_lib";

			$follow = 1; # used in find command
			$follow_skip = 2; # used in find command

Here is my question, $follow and $follow_skip I want to be a global variable
in the scope of the perl script I am running.
If I put a my in front of the declaration wouldn't it only be in the scope
of BEGIN or would it be in the scope of the entire script? How can I declare
it so that use strict; and use warnings; won't complain?

(This has to be a global variable for I use it several subroutines and is OS

Nikola Janceski

Too many of us look upon Americans as dollar chasers. This is a cruel libel,
even if it is reiterated thoughtlessly by the Americans themselves.
-- Albert Einstein (1879-1955) 

The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About