I am not sure what I need nor how to do it (even after reading through the past discussions). It's all very confusing to me. Let me explain my scenario:

I want to parse through my downloaded bank file (a CSV file and I already figured out how to parse it correctly). I have figured out how to read through each line and separate the debits and credits into various variables such as:

Payments (to me):
Shopify
Etsy
PayPal
Misc
And the same with debits: Supplies
Shipping
Ads
Online

The issue that I am running into is that I need to split all of this off on an per month basis. My logical mind is telling me to use an @array where $array1 is January, $array2 is February, etc... for each month. (Yes, I am skipping $array[0], just to keep it simple) I could add a hash to the array to corraliate for the month using the key names above. I want to add those values on a dymanic basis as I reiterate through the CSV file. Hopefully, I explained that correctly.

My issue is that I do not know how to reference, for example, the Paypal payment to me for, say, March. and add these totals on an ongoing basis? For example

CSV LINES:

Debit,03/06/2024,Paypal paymemnt, 25.25,debit_card
Debit,03/09/2024,Paypal paymemnt, 10.13,debit_card
Debit,03/15/2024,Etsy paymemnt, 52.23,debit_card
Debit,03/22/2024,Paypal paymemnt, 16.52,debit_card

#/usr/bin/perl # use strict; use warnings; use Text::CSV; my @chaseArray; my $chaseCSV = Text::CSV->new ({ binary => 1 }); open my $inFile, '<', "chase.csv" or die $!; my @chaseList; my ($cCosts, $cShip, $cGrovery, $cSocial, $cMonthly, $cMisc, $cShopify +, $cEtsy, $cPaypal, $cVenmo, $csMisc, $cTotal) = 0; while (my $row = $chaseCSV->getline ($inFile)) { @chaseList = @$row; my $month = substr ($chaseList[1], 0, ); if ( $chaseList[2] =~ /.*Shopify.*/ ) { my $temp = $chaseList[3] + %@chaseArray[$month]{Shopify}; # @%chaseArray[$month]{Shopify} += $chaseList[3]; %@chaseArray[$month]{Shopify} = $temp; } } print Dumper \@chaseArray;

I keep getting these errors and I am not sure how to fix it. Any help would be greatly apprecaited.


Note:
Once I get the shopify payments adding correctly, I'll put some elsif statements in there for the rest of the items on my list.


In reply to Hash of Arrays? OR Array of Hashes by fritz1968

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.