This is the first perl poem I have written that does not cause compile errors. I was flipping through channels and the only thing was news updates about the presidential campaigns. So, in an attempt to sum up the campaigns from my point of view, I created this small script. It is pretty simple. There is probably a nicer looking way to get the month, but I do not have any modules installed for the purpose.
NOTES:
Line 21: I did set Kerry to odd on purpose, I see him as a very odd man
Line 36: Bush approaches the issues from the right, ;)
Line 42: Kerry approaches the issues from the left, :)
Eventually Kerry keeps shifing the issues (usually to him being a war hero), and Bush keeps popping the issues, to the point the issues just vanish, and no longer matter.
#!/usr/bin/perl -w
use strict;
#############################
# #
# The Bush Kerry camaign, #
# a perl approach. #
# #
#############################
our @issues = (1,2,3,4,5,6,7,8,9);
our $candidate = "";
our ($seconds, $minutes, $hours, $mday, $month, $year, $wday, $yday, $
+isdst) = localtime;
my $x = 0;
while($month != 11) {
if($x%2 == 0) {
$candidate = "Bush";
&campaign("Bush");
} else {
$candidate = "Kerry";
&campaign("Kerry");
}
$x++
}
sub campaign {
if($_[0] eq "Bush") {
pop @issues;
my $issues = @issues;
}
if($_[0] eq "Kerry") {
shift @issues;
my $issues = @issues;
}
}
This is something that I just did for fun. I do not support either candidate, election day for me is an attempt to pick the lesser of two evils :).
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.