Baby's First Perl Script

Jul 08, 2005 18:27

Alright, maybe my second ...

while (<>) { push @{$ws_count{+split}}, $_; }

while (($num, $words) = each %ws_count)
{
print "\n----- \#$num -----\n\n";
foreach (@$words) { print; }
}

Though honestly, the first line is the impressive bit, the rest is just nice output formatting.

Bonus points for whoever can figure out what it does! (I actually thought about obfuscating it more by making all the variables names something like $a $b $c, but then I figured that would just be cruel, so I left the original variable names).
Previous post Next post
Up