Below is the code, any Help Please, Thank you very much
use warnings ; use Data::Dumper; my %results = (); while ( <DATA> ) { chomp ; my @row = split /,/, $_ ; print STDOUT "row values is:".$_."\n"; if ( (exists $results{ $row[0], $row1 })) { if ( ( $row2 ) < $results{ $row[0], $row1 }->{ 'ACTDATE' } ) { $results{ $row[0],$row1 }->{ 'ACTDATE' } = $row2 ; } print STDOUT "inactdate--".$row3." \n"; print STDOUT "in memory inact--".$results{ $row[0] }->{ 'INACTDATE' }. +"\n"; if ( ( defined $row3) && !( defined $results{ $row[0] }->{ 'INACTDATE' + } ) ) { $results{ $row[0] }->{ 'INACTDATE' } = undef ; } elsif ( !( defined $row3) && ( defined $results{ $row[0] }->{ 'INACTDA +TE' } ) ) { $results{ $row[0] }->{ 'INACTDATE' } = undef ; } elsif( ( $row3 ) > ( $results{ $row[0], $row1 }->{ 'INACTDATE' } ) ) { $results{ $row[0], $row1 }->{ 'INACTDATE' } = $row3; } } else { # Create new entry in hash $results{ $row[0],$row1 } = { 'A1' => $row[0], 'B1' => $row1, 'ACTDATE' => $row2, 'INACTDATE' => $row3, } } } foreach ( sort keys %results ) { my $a1 = $results{ $_ }->{ 'A1' } ; my $b1 = $results{ $_ }->{ 'B1' } ; my $actDt = $results{ $_ }->{ 'ACTDATE' } ; my $inactDt = $results{ $_ }->{ 'INACTDATE' }; print "$a1,$b1,$actDt,$inactDt\n" ; } __DATA__ 7900724655,200906888,20180416,20180522 7900724655,200906889,20180724,20180728 7900724655,200906889,20180601,20180720 7900724655,200906888,20180730,20180830 7900724655,200906890,20180905,20180930 7900724655,200906890,20181005,20181030 7900724655,200906890,20181104, 7900724666,200906868,20180416,20180522 7900724666,200906869,20180601,20180720 7900724666,200906869,20180724,20180728 7900724666,200906868,20180730,20180830 7900724666,200906890,20180905,20180930 7900724666,200906890,20181005,20181030 7900724666,200906890,20181104,

-------I am getting error as uninitialized variable----------

row values is:7900724655,200906888,20180416,20180522 row values is:7900724655,200906889,20180724,20180728 row values is:7900724655,200906889,20180601,20180720 inactdate--20180720 Use of uninitialized value in concatenation (.) or string at web_New_A +DDON.pl line 16, <DATA> line 3. in memory inact-- row values is:7900724655,200906888,20180730,20180830 inactdate--20180830 Use of uninitialized value in concatenation (.) or string at web_New_A +DDON.pl line 16, <DATA> line 4. in memory inact-- row values is:7900724655,200906890,20180905,20180930 row values is:7900724655,200906890,20181005,20181030 inactdate--20181030

2018-08-02 Athanasius added code tags


In reply to Re^4: sorting and merging in perl by Sekhar Reddy
in thread sorting and merging in perl by Sekhar Reddy

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.