Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: What causes HASH to print?

by Thelonius (Priest)
on Feb 27, 2007 at 16:32 UTC ( #602326=note: print w/replies, xml ) Need Help??

in reply to Re: What causes HASH to print?
in thread What causes HASH to print?

If you have "use warnings;" in your code (or run with "perl -w"), you should get the warning:
Reference found where even-sized list expected
If you don't have "use warnings;", then put it in before asking a question. The warnings are there to help you, not annoy you.

UPDATE: And, if the warning is a little obscure, which in this case it is if you haven't seen it before, you can also "use diagnostics;". For example, perl -Mdiagnostics -w gives:

Reference found where even-sized list expected at line 2 (W misc) You gave a single reference where Perl was expecting a list with an even number of elements (for assignment to a hash). This usua +lly means that you used the anon hash constructor when you meant to use parens. In any case, a hash requires key/value pairs. %hash = { one => 1, two => 2, }; # WRONG %hash = [ qw/ an anon array / ]; # WRONG %hash = ( one => 1, two => 2, ); # right %hash = qw( one 1 two 2 ); # also fine

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://602326]
[PriNet]: i think i found the problem, the "source" array that sets the individual key values isn't being cleared, it's keeping the previous values...
[atcroft]: PriNet: You might consider posting a small, self-contained snippet of that segment of your code, and see if someone else has a better idea.....
[atcroft]: PriNet: Ahhh... interesting.
[PriNet]: small would be a problem *heh*... the program reads all the lines from a pdf and converts the individual colum data to a seperate key/value pair... that's where the "previous" array from the pdf is not being cleared properly before reading the next pdf
[atcroft]: PriNet: It was a thought....
[PriNet]: thanx... actually just having someone to talk to was making me think... *heh*

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2017-06-28 03:16 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (620 votes). Check out past polls.