hello monks !!! below is my text file which I am reading

1111111111 GENERAL BT 00318 06/08/19 CSH DE +P 1 +12.00 3336328 06/08/19 CSH DE +P 2 +24.00 3336328 06/08/19 CSH DE +P 1,2 +00.00 3336328 06/08/19 CSH DE +P 2,4 +00.00 3336328 2222222222 GREEN VALLY 00318 06/08/19 CSH DE +P 59.00 + 3336328 4226402 1111111111 GENERAL BT 00318 06/08/19 CSH DE +P 1 +12.00 3336328 06/08/19 CSH DE +P 2 +24.00 3336328 06/08/19 CSH DE +P 1,2 +00.00 3336328 06/08/19 CSH DE +P 2,4 +00.00 3336328 adadadadadadadasdsdasdasdasdadasdasdasddas 3333333333 GENERAL BT 00318 06/08/19 CSH DE +P 1 +12.00 3336328 06/08/19 CSH DE +P 2 +24.00 3336328 06/08/19 CSH DE +P 1,2 +00.00 3336328 06/08/19 CSH DE +P 2,4 +00.00 3336328 defghghghghghghghgghgh daadad adasdas asdasds asdasdasdasddasddad

I am reading line by line with matching pattern and not able to add the amount in same matched pattern array till the last csh dep so that I can move that data TO databse in specified columns. here is my code below but I am not able to achieve what I want . I am new to perl and not able to figure out how to achieve that<\p>

#!/usr/bin/perl use Net::FTP; use IO::Uncompress::Gunzip qw(gunzip $GunzipError); use Date::Simple qw(d8); use DBI; use DBIx::Dump; use Time::Piece; use Time::Seconds 'ONE_DAY'; if (open(my $fh,'< CASH_REPORT-cfpd0903.txt')){ #or die "Could not open file $!"; while (my $row1 = <$fh>) { if ($row1=~/^.*\b(CSH DEP)\b.*$/) { $row1=~s/^\s+//; my $row2 = $row1; #print "$row1 sachin is here \n"; my @sachin = split/\s+/,$row2; print "@sachin printing array\n"; } }

In reply to Issue in parsing data from file by sachin raj aryan

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.