As threatened, blank verse code in perl. Assumes
use English; Also, doesn't work. For reals.
It doesn't even scan unless you say
The punctuation same as I do. More,
It doesn't function. Too, no references
To Christ-like allegorical conceits
Or even Gawain. But nonetheless it makes
Me laugh and isn't that what counts? Forthwith:
unless ( $this_var == $my_ref ) {
while (my ($key, $value) = each( %my_hash }} )) {
print TO_OUTPUT "$key is $ARG\n" and die;
}
return undef if $this_var == 1;
use English; Also, doesn't work. For reals.
It doesn't even scan unless you say
The punctuation same as I do. More,
It doesn't function. Too, no references
To Christ-like allegorical conceits
Or even Gawain. But nonetheless it makes
Me laugh and isn't that what counts? Forthwith:
unless ( $this_var == $my_ref ) {
while (my ($key, $value) = each( %my_hash }} )) {
print TO_OUTPUT "$key is $ARG\n" and die;
}
return undef if $this_var == 1;
How do *you* pronounce the first line? I can't get it to scan unless you pronounce the dollar sign on one var and not the other.
And I can't get the iambs to line up on the TO_OUTPUT filehandle.
And, um, syntax error; you need to close the unless's curly brace.
Yeah, I dunno why I'm critiquing, but there you have it.
And doh! syntax error!
# the following scans (for me anyway) if you pronounce as follows: # $ = "dollar" # < = "is less than" # \n = "newline" # . = "dot" # x = "ecks" # ||= = "or equals" # parens, semi-colons, commas, quote marks, #: silent # # It also actually runs and prints out 14 lines of iambic pentameter # if you call it as: print write_a_poem(5) # sub write_a_poem { # commented, somewhat my $metre = shift; # iambs my ($line, @poem, $max); $max ||= 14; # lines while ($line < $max) { my $this = (("iamb" . " ") x $metre) . "\n\n"; sleep 1; use warnings; $line++; push @poem, $this or die; } return @poem; # and it actually works! }1 sub write a poem (commented, somewhat)
2 my dollar metre equals shift (iambs)
3 my dollar line, at pome, dollar max
4 dollar max or equals fourteen (lines)
5 while dollar line is less than dollar max
6 my dollar this equals iamb dot space
7 ecks dollar metre dot newline newline
8 sleep one; use warnings; dollar line plus plus.
9 push at poem dollar this or die.
10 return at poem (and it actually works)
Lines 4, 6, and 9 are a little wacky, iambically speaking, but hell, it compiles -- ship it!