> -----Original Message----- > From: Nikola Janceski [mailto:[EMAIL PROTECTED]] > Subject: the scope of BEGIN {} > > > BEGIN { > 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 > dependent).
I think you can do: use warnings; use strict; use vars qw($follow $follow_skip); Hope this helps... Jason CONFIDENTIALITY NOTICE: ************************************************************************ The information contained in this ELECTRONIC MAIL transmission is confidential. It may also be privileged work product or proprietary information. This information is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution [other than to the addressee(s)], copying or taking of any action because of this information is strictly prohibited. ************************************************************************