CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
what is a different between two variables?

 



digioleg54
User

Jul 12, 2016, 8:16 AM

Post #1 of 11 (5657 views)
what is a different between two variables? Can't Post

I have in my function declared variable my $coaa.
Then I have a loop:

foreach my $coa_data ( keys %chart_accounts ) {
$data->{reports}->{$port_code}->{coaa}->{coaa}->{ $coa_data } = 0 ;
}

I want to know difference between $coaa and }->{coaa}->{coaa}-> in the hash. Are they the same or have some difference?


FishMonger
Veteran / Moderator

Jul 12, 2016, 8:38 AM

Post #2 of 11 (5654 views)
Re: [digioleg54] what is a different between two variables? [In reply to] Can't Post

$coaa is a variable but it's not being used in the code you posted.

The coaa used in that hash key is just a plain simple string. It's not a variable.


(This post was edited by FishMonger on Jul 12, 2016, 8:39 AM)


FishMonger
Veteran / Moderator

Jul 12, 2016, 8:41 AM

Post #3 of 11 (5652 views)
Re: [digioleg54] what is a different between two variables? [In reply to] Can't Post

Please post beginner level questions like this in the Beginner topic area not the Intermediate area.


digioleg54
User

Jul 12, 2016, 8:44 AM

Post #4 of 11 (5650 views)
Re: [FishMonger] what is a different between two variables? [In reply to] Can't Post

I understand, but the program is not mi9ne and I don't understand, why DEVELOPER used string instead variable. And more, when I print it using dumper, is says undef


FishMonger
Veteran / Moderator

Jul 12, 2016, 9:03 AM

Post #5 of 11 (5645 views)
Re: [digioleg54] what is a different between two variables? [In reply to] Can't Post


Quote
I don't understand, why DEVELOPER used string instead variable.


You'll need to ask the developer that question.


Quote
I print it using dumper, is says undef

That would be because it wasn't assigned a value.

I and several others have tried in your other related threads regarding this code to get you to post a more complete sample of the code and the dump output of the hash, but you keep posting small disconnected sections which make it impossible for anyone to help you.

You've been working with perl for more than a year but based on your questions it doesn't appear that you've learned much of anything.


digioleg54
User

Jul 12, 2016, 9:09 AM

Post #6 of 11 (5643 views)
Re: [FishMonger] what is a different between two variables? [In reply to] Can't Post

That developer is already out. I try to troubleshooting program, which really huge, includes packages and 20 scripts. This particular one parsing txt file and put data to the hash. And I don't understand, why he is trying to put some data, but never did. I can email you the parser and the file, but not sure, if somebody can understand it. He put data into hASH so that then get from hash data and create a report. However, report cannot be, because he is ujsing those string and I don't know why


FishMonger
Veteran / Moderator

Jul 12, 2016, 9:13 AM

Post #7 of 11 (5639 views)
Re: [digioleg54] what is a different between two variables? [In reply to] Can't Post

Maybe its a typo and he meant to use the $coaa variable but left of the $ sigil.


digioleg54
User

Jul 12, 2016, 9:32 AM

Post #8 of 11 (5637 views)
Re: [FishMonger] what is a different between two variables? [In reply to] Can't Post

$coaa separate has data, but when I print Dumper
($data->{reports}->{$port_code}->{$coaa}->{ $coa_data }); it says undef.
$coa_data alsop has data.
something is really stupid


FishMonger
Veteran / Moderator

Jul 12, 2016, 9:42 AM

Post #9 of 11 (5634 views)
Re: [digioleg54] what is a different between two variables? [In reply to] Can't Post

You need to dump each of the vars and inspect the hash structure to verify it has the key structure that you expect based on those vars.


Code
print Dumper($port_code, $coaa, $coa_data, $data);



digioleg54
User

Jul 12, 2016, 10:01 AM

Post #10 of 11 (5632 views)
Re: [FishMonger] what is a different between two variables? [In reply to] Can't Post

can you tell me how can I put each of them to out file using Dumper on Windows?


FishMonger
Veteran / Moderator

Jul 12, 2016, 10:08 AM

Post #11 of 11 (5629 views)
Re: [digioleg54] what is a different between two variables? [In reply to] Can't Post

Is this a web app or a command line app?

If it's a command line app, you can use output redirection to redirect the output to a file.

Another option is to open a filehandle and print to that handle instead of the default STDOUT handle

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives