This does make it clearer, but not entirely. Is this what is happening: the loop starts, and goes immediately into the if statement. when the regex finds a line with "Jump Shot" it stores that in $2, and the player name in $1. The next thing it does, and I'm not quite sure how, is it populates a hash. Creating it I understand, populating it not so much. Maybe if I write it as $linehash{$1} = $linehash{$1}++; though, that still doesn't clear up the populating part. Next, it numbers the line, and somehow figures that it's not just numbering each line that is within the hash, but rather each separate line that contains the set of individual players. Then it starts all over again, and overwrites each individual player element when it needs to be incremented. This part I understand. Can you explain the rest with more detail? If not, can you point me in the direction of a book or resource that talks about this %seek idiom? Thanks. -stu
--- James Edward Gray II <[EMAIL PROTECTED]> wrote: > On Monday, June 2, 2003, at 06:54 PM, Stuart White > wrote: > > > I don't understand this syntax: > > > > $linehash{$1}++; > > > > Could you explain it to me? > > Absolutely. > > This is a common Perl technique, often used with a > hash named '%seen' > because that's exactly what it's keeping track of. > $1 is where you > were capturing your names, I just made that the key > to the hash and the > ++ just increments the value. In long form it's > $linehash{$1} = > $linehash{$1} + 1. In english that's, "Add one to > the value stored in > %linehash at $1, replacing the old value." The > first time a name is > seen it's value will be undef, which conveniently > numifies to 0. > > Hope that clears it up a little. Good luck with > your program. > > James > > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]