Mailing List Archive

Maybe NOT so simple...
I received two responses to this, for which I am grateful, but neither
worked.

First, I replaced all of the "local" declarations with "my"
declarations. This removed all of the errors, but (as I thought it might)
it then kept those variables from being used in any subroutines. I need
these variables to be passed to subroutines, and returned. I suppose I
could just keep renaming variables as I pass them to subroutines, so that
everything can be defined with "my", but then what is the use of having a
"local" declaration available in the first place?

Second, I tried the solution below, but that did not remove the errors at all:

use LWP::Simple;
use CGI qw(:standard);
use Time::CTime;
use strict;
use vars qw(%labels,%nhllist,%nbalist,%nfllist,%mlblist,%regions);
use vars qw(@reglist,@nhllist,@nbalist,@nfllist,@mlblist);
use vars qw(@today,@tables,@r,@nhlteam,@nbateam,@mlbteam,@nflteam,@region);
use vars qw($R1,$R2,$R3,$R4,$R5);
use vars
qw($now,$oneday,$searchtype,$nhlteam,$nbateam,$nflteam,$mlbteam,$region);

I even tried "use strict qw(subs vars);" , but that did not work either.

Any other ideas? I am out of them.

Thanks, Jonathan

at12:11 PM 2/16/00 -0800, you wrote:
>use vars qw(%nhllist %nbalist %nfllist %mlblist %regions);
>
>cliff rayman
>genwax.com
>
>"J. Meltzer" wrote:
>
> > Global symbol "$nbateam" requires explicit package name at sports.cgi
> line 59.
> > Variable "$nbateam" is not imported at sports.cgi line 59.
> >
> >
> >
> > use LWP::Simple;
> > use CGI qw(:standard);
> > use Time::CTime;
> > use strict;
> >
> > require "./hashdata.pl";
> >
> > local (%nhllist,%nbalist,%nfllist,%mlblist,%regions) = {};
> > local (@reglist,@nhllist,@nbalist,@nfllist,@mlblist) = [];
> >
RE: Maybe NOT so simple... [ In reply to ]
It is simple. You should not use global variables.

On 16-Feb-00 J. Meltzer wrote:
> I received two responses to this, for which I am grateful, but neither
> worked.
>
> First, I replaced all of the "local" declarations with "my"
> declarations. This removed all of the errors, but (as I thought it might)
> it then kept those variables from being used in any subroutines. I need
> these variables to be passed to subroutines, and returned. I suppose I
> could just keep renaming variables as I pass them to subroutines, so that
> everything can be defined with "my", but then what is the use of having a
> "local" declaration available in the first place?
>
> Second, I tried the solution below, but that did not remove the errors at
> all:
>
> use LWP::Simple;
> use CGI qw(:standard);
> use Time::CTime;
> use strict;
> use vars qw(%labels,%nhllist,%nbalist,%nfllist,%mlblist,%regions);
> use vars qw(@reglist,@nhllist,@nbalist,@nfllist,@mlblist);
> use vars qw(@today,@tables,@r,@nhlteam,@nbateam,@mlbteam,@nflteam,@region);
> use vars qw($R1,$R2,$R3,$R4,$R5);
> use vars
> qw($now,$oneday,$searchtype,$nhlteam,$nbateam,$nflteam,$mlbteam,$region);
>
> I even tried "use strict qw(subs vars);" , but that did not work either.
>
> Any other ideas? I am out of them.
>
> Thanks, Jonathan
>
> at12:11 PM 2/16/00 -0800, you wrote:
>>use vars qw(%nhllist %nbalist %nfllist %mlblist %regions);
>>
>>cliff rayman
>>genwax.com
>>
>>"J. Meltzer" wrote:
>>
>> > Global symbol "$nbateam" requires explicit package name at sports.cgi
>> line 59.
>> > Variable "$nbateam" is not imported at sports.cgi line 59.
>> >
>> >
>> >
>> > use LWP::Simple;
>> > use CGI qw(:standard);
>> > use Time::CTime;
>> > use strict;
>> >
>> > require "./hashdata.pl";
>> >
>> > local (%nhllist,%nbalist,%nfllist,%mlblist,%regions) = {};
>> > local (@reglist,@nhllist,@nbalist,@nfllist,@mlblist) = [];
>> >

---
Jason Bodnar + jbodnar@tivoli.com + Tivoli Systems

I swear I'd forget my own head if it wasn't up my ass. -- Jason Bodnar
Re: Maybe NOT so simple... [ In reply to ]
it looks like you need to study up on your perl.
you used the qw() syntax - but used commas to separate
the vars. notice my example does not use commas.

try it without the commas and let me know how that works.

cliff rayman
genwax.com

"J. Meltzer" wrote:

> I received two responses to this, for which I am grateful, but neither
> worked.
>
> First, I replaced all of the "local" declarations with "my"
> declarations. This removed all of the errors, but (as I thought it might)
> it then kept those variables from being used in any subroutines. I need
> these variables to be passed to subroutines, and returned. I suppose I
> could just keep renaming variables as I pass them to subroutines, so that
> everything can be defined with "my", but then what is the use of having a
> "local" declaration available in the first place?
>
> Second, I tried the solution below, but that did not remove the errors at all:
>
> use LWP::Simple;
> use CGI qw(:standard);
> use Time::CTime;
> use strict;
> use vars qw(%labels,%nhllist,%nbalist,%nfllist,%mlblist,%regions);
> use vars qw(@reglist,@nhllist,@nbalist,@nfllist,@mlblist);
> use vars qw(@today,@tables,@r,@nhlteam,@nbateam,@mlbteam,@nflteam,@region);
> use vars qw($R1,$R2,$R3,$R4,$R5);
> use vars
> qw($now,$oneday,$searchtype,$nhlteam,$nbateam,$nflteam,$mlbteam,$region);
>
> I even tried "use strict qw(subs vars);" , but that did not work either.
>
> Any other ideas? I am out of them.
>
> Thanks, Jonathan
>
> at12:11 PM 2/16/00 -0800, you wrote:
> >use vars qw(%nhllist %nbalist %nfllist %mlblist %regions);
> >
> >cliff rayman
> >genwax.com
> >
> >"J. Meltzer" wrote:
> >
> > > Global symbol "$nbateam" requires explicit package name at sports.cgi
> > line 59.
> > > Variable "$nbateam" is not imported at sports.cgi line 59.
> > >
> > >
> > >
> > > use LWP::Simple;
> > > use CGI qw(:standard);
> > > use Time::CTime;
> > > use strict;
> > >
> > > require "./hashdata.pl";
> > >
> > > local (%nhllist,%nbalist,%nfllist,%mlblist,%regions) = {};
> > > local (@reglist,@nhllist,@nbalist,@nfllist,@mlblist) = [];
> > >