Hi I seem to have a strange issue where adding a keys into a hash is not being considered as unique
So say I have two files being the keys

$file1 = 'ENV.FILESOURCE.SOURCE.J2018058.N000001'; $file2 = 'ENV.FILESOURCE.SOURCE.J2018059.N000001'; open LOG, "<$log"; while (defined($line=<LOG>)) { chomp $line; if ($line =~/File \[\/opt\/app\/data\/pulsefba\/process/) { ($processingFile) = ($line =~ /process\/(.+)]/); $files{"$processingFile"} = 1; } if ($line =~ /Finished/) { ($currentFile) = ($line =~ /process\/(.+?)]/); ($read) = ($line =~ /: Read \[(.+)\] events - Processe +d /); ($processed) = ($line =~ /Processed \[(.+?)\]/); ($wrote) = ($line =~ /Wrote \[(.+?)\]/); ($skippedRead) = ($line =~ /Skipped Read \[(.+?)\]/); ($skippedProcess) = ($line =~ /Skipped Process \[(.+?) +\]/); ($skippedWrite) = ($line =~ /Skipped Write \[(.+?)\]/) +; ($totalCount) = ($line =~ /Total Trailer Count - \[(.+ +?)\]/); $files{"$currentFile"}{'read'} = $read; $files{"$currentFile"}{'processed'} = $processed; $files{"$currentFile"}{'wrote'} = $wrote; $files{"$currentFile"}{'skippedRead'} = $skippedRead; $files{"$currentFile"}{'skippedProcess'} = $skippedPro +cess; $files{"$currentFile"}{'skippedWrite'} = $skippedWrite +; $files{"$currentFile"}{'totalTrailerCount'} = $totalCo +unt; print "Debug: $currentFile set to Read: $read\n"; print "File ENV.FILESOURCE.SOURCE.J2018058.N000001 cou +nt: $files{'ENV.FILESOURCE.SOURCE.J2018058.N000001'}{'read'}\n"; print "File ENV.FILESOURCE.SOURCE.J2018059.N000001 cou +nt: $files{'ENV.FILESOURCE.SOURCE.J2018059.N000001'}{'read'}\n"; }

While looping through a file Output is like below. How Come is file with the J2018059 getting values in the hash for file J2018058?
Debug: ENV.FILESOURCE.SOURCE.J2018058.N000001 set to Read: 1000
File ENV.FILESOURCE.SOURCE.J2018058.N000001 count: 1000
File ENV.FILESOURCE.SOURCE.J2018059.N000001 count: 1000
Debug: ENV.FILESOURCE.SOURCE.J2018058.N000001set to Read: 2000
File ENV.FILESOURCE.SOURCE.J2018058.N000001 count: 2000
File ENV.FILESOURCE.SOURCE.J2018059.N000001 count: 2000
Debug: ENV.FILESOURCE.SOURCE.J2018058.N000001 set to Read: 3000
File ENV.FILESOURCE.SOURCE.J2018058.N000001 count: 3000
File ENV.FILESOURCE.SOURCE.J2018059.N000001 count: 3000
Debug: ENV.FILESOURCE.SOURCE.J2018058.N000001 set to Read: 4000
File ENV.FILESOURCE.SOURCE.J2018058.N000001 count: 4000
File ENV.FILESOURCE.SOURCE.J2018059.N000001 count: 4000
Debug: ENV.FILESOURCE.SOURCE.J2018058.N000001 set to Read: 5000
File ENV.FILESOURCE.SOURCE.J2018058.N000001 count: 5000
File ENV.FILESOURCE.SOURCE.J2018059.N000001 count: 5000


In reply to Perl hash keys not considered unique by elfstones65

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.