in reply to Golf: Count unique words

One might wonder why you're using s/// to replace something with itself rather than just using nested while loops and a m// instead.

while( <> ) { while( /\b(\w+)\b/g ) { $w{$1}++; $t++; } }

Update: Duh, you're going for obfuscated not efficiency. Never mind me.

Replies are listed 'Best First'.
Re^2: Golf: Count unique words
by dragonchild (Archbishop) on Nov 30, 2004 at 15:04 UTC
    It's also golfier ... try golfing my reply down without using s///eg ...

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.