in reply to Re: Counting how many times item is occurring and adding the total from array help!
in thread Counting how many times item is occurring and adding the total from array help!

This is what I am tryin to get at the end:

Account 44552 - ccurring 1 time(s) - Total = 900.00
Account 00051O - ccurring 2 time(s) - Total = 1,000.00
Account 01122 - ccurring 2 time(s) - Total = -120.00
...

Grand Total = 1,780.00

Thanks for helping!
  • Comment on Re^2: Counting how many times item is occurring and adding the total from array help!

Replies are listed 'Best First'.
Re^3: Counting how many times item is occurring and adding the total from array help!
by CountZero (Bishop) on Sep 14, 2012 at 20:34 UTC
    Easy! replace the last two lines by:
    say "Account $_ - occurring $accounts{$_}->[1] time(s) - Total = $acco +unts{$_}->[0]" for keys %accounts; say "Grand Total = $g_total";

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      Great help, thanks a lot!!!! On my way to code some more now!!!