Hi, As an exercise I have two files, a library file and a main file. If I try to 'use strict' my script won't run.
What do I have to change so that things will work correctly with out clobbering any of my $vars? Thanks and have a good weekend, Dave G. ----- # library file dbi-lib.pl my $user_name = "******"; my $user_password = "****"; my $sql_server = "sql.******.com"; sub initialize_dbi{ use DBI; $drh = DBI->install_driver( 'mysql' ); $dbh = DBI->connect("DBI:mysql:$user_name:$sql_server", $user_name, $user_password); die "Cannot connect: $DBI::errstr\n" unless $dbh; } sub run_statement{ $stmt = "$_[0]"; $sth = $dbh->prepare($stmt); $sth->execute; } 1; # end dbi-lib.pl ------------------ #!/usr/bin/perl -w # Main PERL file use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); require "dbi-lib.pl"; # use strict; my ($d,$s,$time,$week_day, @data); # mySQL Stuff follows &initialize_dbi; $s= "select date_format(current_date, '%W'), date_format(current_date, '%M %e, %Y');"; &run_statement($s); my ($day,$date_string) = $sth->fetchrow; # This $sth is in the library (or is it package?) dbi-lib.pl, correct? $s = "select dayofweek(date_sub(current_date, interval 15 day)), current_time, date_format(current_date, '%b %e, %Y %a');"; &run_statement($s); ($week_day,$time,$current_date) = $sth->fetchrow_array; more stuff..... *====================================================* * Cora Connection Your West African Music Source * * http://www.coraconnection.com/ * * Resources, Recordings, Instruments & More! * *====================================================* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]