On Jun 28, Ryan Frantz said:
for my $host (@hosts) { my %freq;$freq{$_}++ for grep /$host/i, @logfile; # open file for (sort keys %freq) { print "$_: $freq{$_}\n"; } # close file }I noticed that you use the default '$_'; as a matter of style/programming, what is preferred? Use of $_ or $scalar ?
I prefer to use the default variable when I'm going to use functions that USE the default variable, or when it's a very simple and small loop like above. I don't use the default variable when I use the iterating variable a lot (and it needs a descriptive name).
-- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://japhy.perlmonk.org/ % have long ago been overpaid? http://www.perlmonks.org/ % -- Meister Eckhart -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
