Created
April 16, 2012 04:56
-
-
Save bradfitz/2396390 to your computer and use it in GitHub Desktop.
Cognac Hacking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
my $rockettop = <<'END'; | |
. | |
/ \ | |
/ \ | |
END | |
my $rocketmid = <<'END'; | |
| X | | |
| | | |
END | |
my $rocketbot = <<'END'; | |
/ | | | \ | |
END | |
my @girls; | |
for my $line (split(/\n/, `curl -s http://www.census.gov/genealogy/names/dist.female.first`)) { | |
$line =~ s/\s.+//; | |
push @girls, $line; | |
} | |
while (1) { | |
my $girl = $girls[int(rand() * scalar(@girls))]; | |
my $rocket = $rockettop; | |
for my $let (split(m//, $girl)) { | |
my $frag = $rocketmid; | |
$frag =~ s/X/$let/; | |
$rocket .= $frag; | |
} | |
$rocket .= $rocketbot; | |
my $indent = " " x int(rand() *30.0); | |
my @lines = split(/\n/, $rocket); | |
for my $l (@lines) { | |
print "$indent$l\n"; | |
select undef, undef, undef, 0.05; | |
} | |
print "\n"; | |
} |
Barely. I write almost exclusively in Go these days. (that's my full-time job at Google, working on Go).
This was the first Perl I'd written in years.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice to see you are still hacking in Perl. I've moved onto nodejs. :)