I guess I'm not understanding what I'm doing (or have been reading in my
web searches)... Can someone explain the difference between these two
code snippets...

SUN83-PRODWEB>more foo
#! /usr/local/bin/perl
        use strict;
        my %t;
        my ($a, $c);
        my ($aa, $cc);
        $a=$aa=1;
        $c=$cc=q{Additional Electrical Circuit};
        $t{$a}{$c}{AMT}=1000;
        $c=q{Additional};
        $t{$a}{$c}{AMT}=2;
        print $t{$aa}{$cc}{AMT}, "\n";
        &Ix($t{$aa}{$cc}{AMT});
sub Ix {
        my ($v) = @_;
        print "v=$v\n";
        }
SUN83-PRODWEB>./foo
1000
v=1000
SUN83-PRODWEB>


And 
     1  #! /usr/local/bin/perl -d
     2  use strict;
   106  my ($prev_fund, $prev_service, $prev_acct);
   107  my %totals=();
   108  while ($sth->fetch) {
   109      if ($fund ne $prev_fund) {
   110
&PrintAcctTotal($totals{$prev_fund}{$prev_service}{$prev_acct}{AMT},
   111
$totals{$prev_fund}{$prev_service}{$prev_acct}{QTY});
   112
&PrintServiceTotal($totals{$prev_fund}{$prev_service}{AMT},
   113              $totals{$prev_fund}{$prev_service}{QTY});
   114          &PrintFundTotal($totals{$prev_fund});
   115          }
   116      elsif ($service ne $prev_service) {
   117          print
"(prev_fund,prev_service)=<$prev_fund,$prev_service>\n";
   118          print "value
=<$totals{$prev_fund}{$prev_service}{AMT}>\n";
   119
&PrintServiceTotal($totals{$prev_fund}{$prev_service}{AMT},
   120              $totals{$prev_fund}{$prev_service}{QTY});
...
   150      $totals{$fund}{$service}{$acct}{AMT} += $amt;
   151      $totals{$fund}{$service}{$acct}{QTY} += $n_qty;
   152      $totals{$fund}{$service}{AMT} += $amt;
   153      $totals{$fund}{$service}{QTY} += $n_qty;
   154      $totals{$fund} += $amt;
   155      $prev_fund = $fund;
   156      $prev_service = $service;
   157      $prev_acct = $acct;
   158      }

SUN83-PRODWEB>./journal_items.pl

Loading DB routines from perl5db.pl version 1.27
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(./journal_items.pl:17):  my %param = (
main::(./journal_items.pl:18):          PERIOD=>'',);
  DB<1> c
(prev_fund,prev_service)=<Y,Additional Electrical Circuit>
Can't use string ("3862926") as a HASH ref while "strict refs" in use at
./journal_items.pl line 118.
 at ./journal_items.pl line 118
Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.
  DB<1> q
SUN83-PRODWEB>

Thank you in advance... 
John W Moon


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to