my is what it implies - it declares a variable local to that scope.
What you want is "our" which works the same as "my" but declares
the variable to be in global scope, it replaces the Perl 5.5 method
of "use vars qw(<varlist>)"
-Peter
> -----Original Message-----
> From: Roland Corbet [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 31, 2001 8:27 AM
> To: [EMAIL PROTECTED];
> [EMAIL PROTECTED]
> Subject: Using "my" with "require" files
>
>
> Many of my scripts depend upon requiring a config file which
> stores common
> subroutines and global variables, applicable to more than one
> script. I
> add this to my script that is currently running using the:
>
> require 'foo.plx' ;
>
> line.
>
> Wishing to better my programming, I want to use the "my"
> command in order
> to declare my variables. However, I have found that a
> variable declared
> with "my" in the required file is not available in the script
> that calls
> the require file.
>
> Does anyone know a way around this problem? Is it not
> possible to use my
> in the require scenario?
>
> Any help would be appreciated.
>
> TIA
>
> Roland
>
>
> --
> The information contained within this e-mail sent by Cradley
> Print Ltd. is
> confidential and is intended for the named recipient only. If
> you are not
> the intended recipient please notify us by telephone
> immediately on 01384
> 414100 (UK)or +(44)1384 414100 (International) or return it
> to us by e-mail
> quoting the name of the sender and the addressee. Please then
> delete it from
> your system.
>
> Encryption and Viruses
> ==================
> Please note that this e-mail and any attachments have not
> been encrypted.
> They may therefore be liable to be compromised. Please also
> note that it is
> your responsibility to scan this e-mail and any attachments
> for viruses.
> Viruses and compromises of security are inherent risks in relation to
> e-mail.
>
> We do not, to the extent permitted by law, accept any
> liability (whether in
> contract, negligence or otherwise) for any virus infection
> and/or external
> compromise of security and/or confidentiality in relation to
> transmissions
> sent by e-mail.
>
> Contracts
> ========
> Please note, that contracts may NOT be concluded on behalf of
> Cradley Print
> Ltd by e-mail, but contracts on behalf of our clients may be
> concluded by
> e-mail.
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/activeperl
>
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web