Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^4: Hash of Hash of Arrays

by voltas (Novice)
on Aug 26, 2016 at 10:54 UTC ( #1170539=note: print w/replies, xml ) Need Help??

in reply to Re^3: Hash of Hash of Arrays
in thread Hash of Hash of Arrays

Thanks a ton duyet.. You are a life saver :) One final question pls. The log file has been updated with a new entry called Files, like below for example
JIRA: COM-6789 Program:Testing Reviewer:Chan Joe Description:SO hwat rev:r698392 Files: dev/src/com/user/st/recall/api/ ------------------------------------------ JIRA: COM-6789 Program:Testing Reviewer:Chan Joe Description:Paid the Due rev:r327896 Files:base/dev/src/com/myorg/ng/order/util/Util.jsp;base/dev/src/com/m +yorg/ng/sterling/sth/api/Update.jsp base/dev/src/com/myorg/ng/order/basedesign/util/HDrals.jsp base/dev/src/com/myorg/ujio/update/test.jsp
Since 'Files' may have multiple file entries separated by a newline like above, I'm facing the below message
Files => base/dev/src/com/myorg/ng/order/util/Util.jsp;base/dev/src/ +com/myorg/ng/sterling/sth/api/Update.jsp Description => My design initiative . Use of uninitialized value in concatenation (.) or string at l +ine 62, <FH> line 55. => base/dev/src/com/myorg/ng/order/basedesign/util/HDrals.jsp
Kindly can you enlighten me how to handle the same and display the File entries one after anothe ?Thanks again.

Replies are listed 'Best First'.
Re^5: Hash of Hash of Arrays
by duyet (Friar) on Aug 27, 2016 at 01:22 UTC
    The code in the else block within the while loop should be changed:
    # store data in a temp hash if ( $line =~ m/:/ ) { my ( $key, $value ) = split /:\s*/, $line; $hash->{ $key } = $value; } elsif ( $line =~ m#/# && exists $hash->{Files} ) { $hash->{Files} .= ";$line"; }
          Thanks much Duyet.. Really appreciate your ur suggestions and for your valuable time. WRT your suggestion I tried modifying your logic to accommodate further new entries into the log file. New values 'DEV' and 'QA' have been added along with the JIRA, like below:
          ------------------------------------------ DEV: COM-1258 Program:Testing Reviewer:Jackie Description:New Entries rev:r145201 ------------------------------------------ QA: COM-9696 Program:Testing Reviewer:Poikla Description:Some random changes rev:r112356 ------------------------------------------ JIRA: COM-1234 Program:Development Reviewer:John Wick Description:Genral fix rev:r345676 ------------------------------------------ JIRA:COM-1234 Program:Development Reviewer:None Description:Updating Received rev:r909276 ------------------------------------------ JIRA: COM-6789 Program:Testing Reviewer:Balise Mat Description:Audited rev:r876391
          Below is the modified section in the code:
          my $program = $hash->{Program} || ''; my $jira = $hash->{JIRA} || ''; my $qa = $hash->{QA} || ''; my $dev = $hash->{DEV} || ''; if ( $program && $jira ) { push @{ $data->{ $program }{ $jira }}, $hash; $hash = {}; } elsif ( $program && $qa) { push @{ $data->{ $program }{ $qa}}, $hash; $hash = {}; } elsif ( $program && $dev) { push @{ $data->{ $program }{ $dev}}, $hash; $hash = {}; } } else ... .... ....
          but its unable to display the value in the format you displayed. I'm getting blank output.It cannot read the new entries QA and DEV . Below is the output i'm looking for
          ================================== Program: Development =================================== ***************** JIRA ID: COM 1234 ***************** rev => r345676 Reviewer => John Wick Description => Genral fix rev => r909276 Description => Updating Received Reviewer => None ================================== Program: Testing =================================== ***************** JIRA ID: COM 6789 ***************** rev => r876391 Description => Audited Reviewer => Balise Mat rev => r698392 Reviewer => Chan Joe Description => SO hwat rev => r327896 Reviewer' => Chan Joe Description' => Paid the Due ***************** DEV ID: COM-1258 ***************** rev => r14521 Reviewer => Jackie foja Description =>New Entries ***************** QA ID: COM-9696 ***************** rev => r112356 Reviewer => Poikla Star Description => Some random changes
          Sorry to test your patience but could you please help me out here . I'm a perl noob , so pls. bear with me.

    Log In?

    What's my password?
    Create A New User
    Node Status?
    node history
    Node Type: note [id://1170539]
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (4)
    As of 2020-04-10 07:11 GMT
    Find Nodes?
      Voting Booth?
      The most amusing oxymoron is:

      Results (49 votes). Check out past polls.