in reply to strict problem

I have a bit of a stupid question - I'm trying to use 'strict', and it's giving me headaches...

Hmm, I'm sorry, but stupid questions are especially forbidden (tsk tsk).

Watch me "bold" some key words (ok)

I have a variable that is returned by a function in another file (@in, in function ReadParse from the well-known cgi-lib.pl). Without strict, I can just execute &ReadParse, and use $in{'...'}; but with strict, it expects me to declare this variable. If I declare it locally in my perlscript (my (@in);) then it uses a different variable (which is logical, it declares a new one in the scope of the current function which 'overwrites' the other var)... So how do I use a variable from a included library-file if strict is on?
You only see errors, when you use strict, so ... What is this strict?

Does it have documentation? And more importantly, does that documentation say anything useful?

The error message that "it" expects you to declare this variable, so .... What are all the ways you can think of declaring a variable?

Where would you read about declaring variables?

What would you have done without perl monks? Hopefully start asking these questions yourself.

After which, you should've stumbled accross perldata and strict, and read like a mad man. In case you didn't stumble accross those, then you need to read How To Read The Friendly Manual which very nicely outlines numerous perl resources, as well as general strategy for finding the answers you're looking for.

Peace! Start communication ;)

update: Great. I would like to point out however, and I did not provide the exact answer as many others have (what would be the point?)

 
______crazyinsomniac_____________________________
Of all the things I've lost, I miss my mind the most.
perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

  • Comment on (crazyinsomniac: questions) Re: strict expects me to declare this variable

Replies are listed 'Best First'.
Re: (crazyinsomniac: questions) Re: strict expects me to declare this variable
by Anonymous Monk on Mar 20, 2002 at 17:20 UTC

    I have read perldata; I am pretty familiar with the concept of a man page and documentation. I also have read the part involving 'strict' very attentive, but could not derive how I'm supposed to declare a variable used (and set) in another file - which I don't wish to touch.

    It's nice to rtfm me, but I'm not new to opensource, the 'net, development, *nix or whatever - I just couldn't find this directly in the (extensive) documentation, and it's not important enough to spend a month of thinking on.

    I _am_ quite new to perl, though. And I tried all the ways I could think of declaring a variable already.

    So, thanks for your referrals, but - don't you know the answer yourself?... - your answer, as it stands, is not really of much help.

    :P

Re: (crazyinsomniac: questions) Re: strict expects me to declare this variable
by Rex(Wrecks) (Curate) on Mar 20, 2002 at 19:02 UTC
    Hmm, this was not particularly helpful :)

    I would like to point out that:
  • there are no stupid questions (answers...maybey :)
  • The poster took the time to create an account and actually login
  • The poster is actually trying to use strict! Which we at the monastary constantly preach
  • The original post did mention he was trying to declare the array, but was not having any luck with syntax.

    On the other hand, you were right, the info could be found in the man pages.

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!