For the first time in my Perl programming, I've had to use formats. Up until now I haven't had a need to use them.
I've gone through the docs, and the Perl Black Book, but I'm not getting output from my data. Well I sort of am, but it's all 0.00 and blanks for the name - not exactly what I want.
My format code is:
format STDOUT = @<<<<<<<<<<<<<<<<<<<< $cust @#####.## @#####.## @#####.## @#####.## @#####.## @#####. +## $d1, $c1, $t1, $d2, $c2,$t2 @#####.## $total .
and the code producing the data is:
foreach $key (sort keys %ytd ){ my ($cust, $d1, $d2, $c1, $c2); my $t1 = $ytd{$key}->{d1}-$ytd{$key}->{c1}; my $t2 = $ytd{$key}->{d2}-$ytd{$key}->{c2}; $total = $t2-$t1; $cust = $key; $d1= $ytd{$key}->{d1}; $d2= $ytd{$key}->{d2}; $c1= $ytd{$key}->{c1}; $c2= $ytd{$key}->{c2}; write; }
but I've done something wrong as I'm not getting values out. I've confirmed that I do have vaild data using print statements, so I believe I've narrowed it down to a problem with my format statement.
My other question is if I can just use the foreach function to pass the variables directly to the write function or do I need to assign each one as I tried to do.
Thanks in advance for any help with this!
There is no emoticon for what I'm feeling now.
In reply to Question on using format and write by Popcorn Dave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |