User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Perl section within the Software Development category of DaniWeb, a massive community of 456,575 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,588 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Perl advertiser: Programming Forums
Views: 823 | Replies: 4
Reply
Join Date: Oct 2007
Posts: 3
Reputation: ranadheer is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ranadheer ranadheer is offline Offline
Newbie Poster

how to use % variables i perl

  #1  
Oct 30th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 3
Reputation: perl21 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
perl21 perl21 is offline Offline
Newbie Poster

Re: how to use % variables i perl

  #2  
Oct 30th, 2007
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.
Reply With Quote  
Join Date: Mar 2006
Posts: 644
Reputation: KevinADC is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 36
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Master Poster

Re: how to use % variables i perl

  #3  
Oct 30th, 2007
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
Reply With Quote  
Join Date: Oct 2007
Location: Russia, St-Petersburg
Posts: 8
Reputation: cerf_machine is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
cerf_machine's Avatar
cerf_machine cerf_machine is offline Offline
Newbie Poster

Re: how to use % variables i perl

  #4  
Nov 2nd, 2007
Root of the problem is outside of the print command. Post the whole code.
Reply With Quote  
Join Date: Feb 2006
Posts: 1,518
Reputation: masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light masijade is a glorious beacon of light 
Rep Power: 10
Solved Threads: 136
masijade's Avatar
masijade masijade is online now Online
Posting Virtuoso

Re: how to use % variables i perl

  #5  
Nov 2nd, 2007
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.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Perl Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Perl Forum

All times are GMT -4. The time now is 6:12 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC