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 ( Read more... )

Leave a comment

lwoody2k July 9 2005, 00:00:47 UTC
That's not too bad, but I think a line like
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

lwoody2k July 9 2005, 00:01:11 UTC
rest. Not res. Yeah...

Reply

iluvsheep July 9 2005, 04:11:46 UTC
Playing a bit too much NS are we?

Reply

lwoody2k July 11 2005, 22:59:07 UTC
Actually, no. WoW is my current crack of choice (or need....) and last time I tried to play NS I couldn't connect to a server. Meh, WoW is Fun and Exciting (tm) for now. And maybe if I don't get bored of it for long enough, they'll finish porting NS to source. Drool.

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

iluvsheep July 12 2005, 15:56:05 UTC
You know what they say, "a watched video game never ports".

Ah yes, the old "forfeiture of soul" clause. I hear that is pretty much boiler plate nowadays.

Reply

lwoody2k July 12 2005, 18:17:07 UTC
Ah, but I am cunningly not checking their website or anything (well, since the one time I went and saw that they were indeed porting it). Therefore it is clearly an unwatched game and will therefore port with much rapidity.

I wonder if I can get a job for them and change all the tooltips to read 'selectrification'....

Reply

lwoody2k July 15 2005, 14:35:41 UTC
I am sure that they owuld enjoy that massive word cluttering up an already cluttered commander interface. That is to say, I am totally behind this idea, because it would amuse me ... for about 5 minutes.

Reply

lwoody2k July 16 2005, 00:09:31 UTC
To be more specific, after thinking it over, it would replace the 'electrify [thingie]' with 'selectrify [thingie]' which works out to only one additional character. Selectrification itself only comes in when you mention something as 'for the win' which is not in the commander's interface...yet!

Reply

iluvsheep July 16 2005, 01:39:25 UTC
Oh man! That would be SOOO good. Every five minutes or something the commander could give an order "for the win!" which would give everyone who followed is some sort of power-up while they were heading to the way point.

And yes, the selectrify change would be cool in a subtle prank sort of way. In fact, you could even make it more subtle by only having it show up every so often and then disappear quickly. Often enough to people notice it, but sparingly enough that people start to doubt that they actually saw it and start to think that they were imagining it.

Reply

lwoody2k July 18 2005, 18:03:29 UTC
This is getting long.

That would be interesting...you'd have to do some kind of voice recognition to require that the commander yells the 'x for the win!' part over team chat. Or public chat, but voice is usually separate from that (though when it's not, games are interesting).

And instead of being subtle, they should recode things so that the commander's interface is described by an html file. Then, since I will be an intern there or something, I'll steal some of your old LJ posts and use those as template. Oh, and a javascript that moves buttons away from your mouse when you try and click! That would be so awesome.

Reply

iluvsheep July 9 2005, 04:11:32 UTC
Yes, but those are just silly regular expressions. None of those are cool enough to use a non-op unary plus operator.

Reply


Leave a comment

Up