hi all,
sorry for posting the same question,i have to this because my last post was really a mess.
now i will try explain my problem in concise


i have variable

my %HeaderHash=();

and i have passed values to the HeaderHash successfully
but while i try to print the HeaderHash data like

print("$HeaderHash{'Deal Name'}\n");

i am getting error like uninitialized value use
but actually i am damn sure that my HeaderHash contains "Deal Name" element with value as "102"
how to get rid fom the prob
thanks in adv
R

Recommended Answers

All 4 Replies

I tested the couple lines you posted and as I suspected they work fine. Your problem is with a different line. You will need to post additional information. Include version of perl just in case that makes any difference.

Post code and sample data. On a side note do not use parenthesis in your print statements:

print("$HeaderHash{'Deal Name'}\n");

better written as:
print "$HeaderHash{'Deal Name'}\n";

while this is not the source of your problem, using parenthesis with the print command is in general a bad habit to get into. Se the print documentation for some details:

http://perldoc.perl.org/functions/print.html

Root of the problem is outside of the print command. Post the whole code.

I will go out on a limb, and assume that you passed this hash to a method, and call the print statement in that method. In this case the print statement needs to be changed to:

print "$HeaderHash->{'Deal Name'}\n";

If that is not the case, then as KevinADC has said (and cerf_machine repeated without acknowledgement), your problem is elsewhere.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.