Thanks for the reply, I realize this is painful. Perl Version: Last login: Thu Oct 4 18:53:15 on ttyp1 Welcome to Darwin! pwbk2003:~ mbarto$ perl -version This is perl, v5.8.6 built for darwin-thread-multi-2level (with 3 registered patches, see perl -V for more detail) Copyright 1987-2004, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. pwbk2003:~ mbarto$ Tried "use" after I declared my with %use and $dbh. Still fails and strict and -w are turned off. Removing the global "my's", it works but only with strict and -w are turned off. Bruce Van Allen wrote: On 10/4/07 Michael Barto wrote:I am working with an old Perl Library (program module) written in Perl4 and Perl 5 depending who was "hacking the code". My program that calls it, uses -w and strict and has identified many syntax errors and so forth in the old library which I fixed. My problem is that this library needs two variables passed as globals to it to use in one of the subroutines, One of them is the $dbh variable created when the database is open. Another is a hash. Both these variables were initiated at the Main top most level of the program with "my". Unfortunately, this causes an error and the libraries does not see the global. If I turn off strict and the -w options and remove the "my">from these variables assignments, the program works. What is going on?I might point out that the start of the subroutine that is causing the problem starts like this.What version of perl is the revised program going to run under?Did you add the my() declaration to the two variables, or was it already there? What happens if you declare them with use vars qw/$dbh %hash/; instead? Best, - Bruce __bruce__van_allen__santa_cruz__ca__ --
|
- "my variable" at global level not being passed Michael Barto
- Re: "my variable" at global level not being... Bruce Van Allen
- Re: "my variable" at global level not b... Michael Barto
- Re: "my variable" at global level not being... Sherm Pendley
- Re: "my variable" at global level not b... Jeremiah Foster