in reply to How to increment a sequence number for evert instance of a value?

Someone had asked me if this was homework....wasn't sure how to respond as it was in the chatter box as a private message (just read the faq...so now I do). This is not homework =) That would require tuition and time off from work he he he. I am learning perl the "hard way".
  • Comment on Re: How to increment a sequence number for evert instance of a value?

Replies are listed 'Best First'.
Re: Re: How to increment a sequence number for evert instance of a value?
by Zero_Flop (Pilgrim) on Jun 26, 2003 at 05:12 UTC
    aschroh

    Tomte answered your question, you can also "perldoc -q unique keys" Perldoc is great, but sometimes it's difficult to think of the key words you are looking for. (if you knew them, you probably wouldn't have to look them up). I have found it's best when just starting out to ask were to look rather than for the answer directly, it shows you want to learn instead of having someone do your HW.
      I agree, I wasn't looking so much for a "here it is use it". I just was lost and not sure how to even approach this. I did a lot of reading on hashes and updating values in hashes last night and now I understand what he was referring to. I appreciate everyones input =)
        Ok this is what I came up with but when I print the output to the screen $invseq has no value. Can anyone see what am I doing wrong....it looks alright to me. Am I using the hash incorrectly?
        if ($flag21 == 1) { foreach $num(@number) { if (($num) eq ($rp1)) { $invseq = $seqi{$rp1}; $invseq = $invseq + 1; $seqi{$rp1} .= $invseq; } else { $seqi{$rp1} .= 1; $invseq = $seqi{$rp1}; push @number, $rp1; } } }