On Monday, June 2, 2003, at 08:10 PM, Stuart White wrote:

Ok, I think I get it.  the $_ is printing the player
name, (though I don't know why I'm not using $1
instead for that)

$1 contains the first capture of the last match we did. When you're using match variables like that, store them somewhere and forget about them. By the time we're printing names out $1 would hold only the last name, if we were lucky. All the information we need is in the hash we created, so we use that instead.


The reason I'm using $_ is because of the foreach loop. It says, for each (conveniently sorted) key of %linehash ($_), print the key ($_) and the value ($linehash{$_}). If no variable is given before the list of a foreach loop, $_ is simply assumed. That's handy since a lot of Perl features (matching for example) target $_ by default.

 and the $linehash{$_} means, in
English, "the value of the key stored in $_" is that
right?

Yes, exactly that.


James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to