I was recently confronted by a challenge to write a Perl program that contained the following code:
fix(YOUR, $hearts) or die;
In the spirit of the "J.A.P.H." programs of old (short for "Just another Perl Hacker", referring to the text printed by the archetypal "J.A.P.H." program), which have been so much a part of Perl's culture for years, I, a trans woman, decided to take on this variation of a Perl challenge with the appended program that I consider to be a "F.Y.H.O.D." in the same spirit.
Granted, the program does not explicitly meet the needs of the challenge since I had set out to use expanded version of the original quote and then found out the prompt was a misquote. Ah, well. I hope the sentiment is appreciated even if it's technically not a "F.Y.H.O.D.".
That said, there is a trivial change that would make it one by the rules of the game, which I happily leave as an exercise for those folks playing around with Perl for the first time...
#!/usr/bin/env perl
# hmm. i suppose this meets the basic fix() api definition.
sub fix {
my ($f, $s) = @_;
print $f $s;
}
# now what can i do to make this interesting...?
# ah yes!
# i could have some fun with words in a very idomatic way...
%cut_up_acrostic = (
"comics" => "<", # by the way, let me add something here
"to" => "s", # just while we're able to add some comments,
"all" => "o", # anyway. but yeah, just wanted to let you
"never" => "m", # know that this is totally worth reading
"clown" => "e", # because some folks will enjoy it greatly.
"confused" => " ", # see, i'm gonna say something that takes
"was" => "t", # slightly more work to selectively remove,
"undercover" => "r", # so as to be better perceived, which is:
"dea" => "a",
"dennis" => "i", # this
"working" => "n", # was
"denise" => "s", # written
"colleagues" => " ", # by
"your" => "c", # a
"used" => "r", # trans
"became" => "o", # woman.
"spoonful" => "s",
"hearts" => "s", # so yeah, wanted to get that off my chest.
"are" => " ", # oh, are you still with me? well, i guess i
"had" => "t", # still have some space to spare, huh? well,
"told" => "h", # just so you know, this took me quite some
"agent" => "e", # time to come up with. about 4 hours now,
"the" => " ", # actually. dunno if that makes the time
"canyon" => "g", # worth it, per se, but it was a nice way
"thing" => "h", # to spend a few hours while recovering from
"were" => "a", # a vaginoplasty, so uh. well, okay, maybe
"sometimes" => "t", # it does make it worth it in a weird way.
"on" => "s", # i guess.
"boss" => "-", # anyway...
"dirt" => ">", # thanks for reading
);
# whee! globals are fun!
foreach my $word ( keys %cut_up_acrostic ) {
my $c = $cut_up_acrostic{$word};
$$word = $c;
}
# then let me just define a few subroutines...
sub grand {
my ($a,) = @_;
$your = $grand . $a;
$a;
}
sub fill {
my ($a,) = @_;
$a;
}
sub before {
my ($a, $b) = @_;
$agent = $a;
$the = $had . $used;
}
sub at {
my ($a, $b) = @_;
$are = $a . $b;
$used = $undercover;
}
sub wild {
my ($a, $b) = @_;
$became = $a . $b;
$grand = $used . $spoonful;
}
sub enough {
my ($a, $b, $c) = @_;
$told = $a . $b;
}
sub great {
my ($a,) = @_;
$a;
}
sub a {
my ($a,) = @_;
$a;
}
sub because {
my ($a,) = @_;
$all = $a;
}
sub you {
my ($a, $b) = @_;
$never = $working;
$on = $boss;
$a . $b;
}
sub when {
my ($a,) = @_;
$colleagues = $a;
}
sub of {
my ($a, $b) = @_;
$a . $b;
}
sub i {
($had, $b, $c) = @_;
$clown = $had;
$comics = $b;
$to = $c;
$spoonful = $dennis;
$never . $denise;
}
sub those {
my ($a, $b, $c) = @_;
open(THEIR, $a) or die "can't open their hearts";
$hearts = "$b $c\n";
}
# and now we can just let the words stand for themselves.
before(you($were, $denise),
when(you($were, $dennis)) and i($was, $your, $boss));
when i($had, you($working, $undercover), at($the, $dea));
you($were, a($confused) and wild($thing, $sometimes));
i($had, enough($dirt, $on, you($to, fill($the))), grand($canyon))
and i($never, $used, a($spoonful));
because(you($were and $are, a(great($agent))))
and when you($became, $denise);
i($told, $all, of($your, $colleagues));
those $clown, $comics, $to;
fix(THEIR, $hearts) or die;