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
(
Read more... )
Comments 17
BTW, instead of "foreach (@$words) {print;}" you can use "print foreach(@$words);" to save a couple characters.
Steve
Reply
I know what I meant, I just didn't type it that way.
Steve
Reply
I should have just included the first line. The rest of it just makes it too easy to figure it all out.
Reply
::use[s] strict;::
Steve
Reply
if(/\s*(.*):\s*([^=]*);\s*(.*)/)
is much more outrageous. And I could go on with silly examples, but I use (or used) that in code.
I missed the part about all lines with same number of words, but got the res.
Reply
Reply
Reply
Also, since I don't want to respond separately to the other comment, I know it's a mere regexp, but it's much less english-y. I have some really bad lines ($_->[0][0][0] = something for example), but I think posting any of the interesting ones does something like break an NDA and makes me lose my soul. Or something.
Reply
One day, I will run into a syntax bending open source developer and will not be able to restain myself as I strangle him. Bystanders will pull me off as the police arrive, but they'll be unable to calm my rage. As the men in white suits taser me, I'll scream about code readability and reuse. When I escape the asylum, I'll become Codeman. My mission: somewhere in this world, syntax abuse is being committed. I will be there to stop it.
The golden age of man will begin, bringing in an era of peace and prosperity. Until the next Bush is elected.
Reply
Reply
Leave a comment