Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: variables not posting?

by stuffy (Monk)
on May 03, 2001 at 11:19 UTC ( #77595=note: print w/ replies, xml ) Need Help??


in reply to Re: variables not posting?
in thread variables not posting?

That did help, thanks. I was wondering if somemonk could explaine why that worked, and why I needed to do that. Stuffy


Comment on Re: Re: variables not posting?
Re: Re: Re: variables not posting?
by epoptai (Curate) on May 03, 2001 at 11:38 UTC
    When you declare %fields inside the scope of the foreach $item (@pairs) loop with my, its contents are private to that loop. Then you try to access %fields after the loop, but it doesn't contain anything since you're outside the closing bracket (scope) of the for loop.

    -w and use strict tell of such errors.

Re: Re: Re: variables not posting?
by busunsl (Vicar) on May 03, 2001 at 11:39 UTC
    With your my declaration in the foreach loop you declared the hash locally.
    So the values you put into it weren't known outside.

    With using strict something like this can't happen because perl will give you an error.

    Have a look here for something more on my.
    You can also do a Super Search

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://77595]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (16)
As of 2014-12-18 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (58 votes), past polls