Re: FAQ 6.15 How can I print out a word-frequency or line-frequency summary?



jidanni@xxxxxxxxxxx wrote:

I saved you 2 bytes!:
--- perlfaq6.ORIG.pod 2009-05-12 01:56:38.000000000 +0800
+++ perlfaq6.pod 2009-05-12 01:57:44.706933151 +0800
@@ -539,8 +539,8 @@
in the previous question:

while (<>) {
- while ( /(\b[^\W_\d][\w'-]+\b)/g ) { # misses "`sheep'"
- $seen{$1}++;
+ while ( /\b[^\W_\d][\w'-]+\b/g ) { # misses "`sheep'"
+ $seen{$&}++;
}
}

I wouldn't use $&
.