Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Poe, E.: Near a Raven - Extracting Pi

by Beatnik (Parson)
on Mar 21, 2001 at 05:07 UTC ( #65931=poem: print w/ replies, xml ) Need Help??

This isn't a genuine Perl poem, but it extracts the 740 decimals of Pi from the modified "The Raven" poem (originally written by Edgar Allen Poe, adapted for Pi by "measuring circles". The poem came from here, page contains more info on the subject as well.
#!/usr/bin/perl # Poe, E.: Near a Raven { local $/ = undef; $poem = <DATA>; } $poem =~ s/[,\."!\?\-:\(\)\']//g; $poem =~ s/[ \t]{2,}//g; $poem =~ s/[\r\n\t]/ /g; #print $poem; (@words) = split(/\W+/,$poem); foreach(@words) { print length != 10 ? length : 0; } #Edit 1: I just needed sleep, I promise :) #} <- Oops :) __END__ Poe, E. Near a Raven Midnights so dreary, tired and weary. Silently pondering volumes extolling all by-now obsolete lore +. During my rather long nap - the weirdest tap! An ominous vibrating sound disturbing my chamber's antedoor. "This", I whispered quietly, "I ignore". Perfectly, the intellect remembers: the ghostly fires, a glitteri +ng ember. Inflamed by lightning's outbursts, windows cast penumbras upo +n this floor. Sorrowful, as one mistreated, unhappy thoughts I heeded: That inimitable lesson in elegance - Lenore - Is delighting, exciting...nevermore. Ominously, curtains parted (my serenity outsmarted), And fear overcame my being - the fear of "forevermore". Fearful foreboding abided, selfish sentiment confided, As I said, "Methinks mysterious traveler knocks afore. A man is visiting, of age threescore." Taking little time, briskly addressing something: "Sir," (robustl +y) "Tell what source originates clamorous noise afore? Disturbing sleep unkindly, is it you a-tapping, so slyly? Why, devil incarnate!--" Here completely unveiled I my antedo +or-- Just darkness, I ascertained - nothing more. While surrounded by darkness then, I persevered to clearly compre +hend. I perceived the weirdest dream...of everlasting "nevermores". + Quite, quite, quick nocturnal doubts fled - such relief! - as my +intellect said, (Desiring, imagining still) that perchance the apparition was + uttering a whispered "Lenore". This only, as evermore. Silently, I reinforced, remaining anxious, quite scared, afraid, While intrusive tap did then come thrice - O, so stronger tha +n sounded afore. "Surely" (said silently) "it was the banging, clanging window lat +tice." Glancing out, I quaked, upset by horrors hereinbefore, Perceiving: a "nevermore". Completely disturbed, I said, "Utter, please, what prevails ahead +. Repose, relief, cessation, or but more dreary 'nevermores'?" The bird intruded thence - O, irritation ever since! - Then sat on Pallas' pallid bust, watching me (I sat not, ther +efore), And stated "nevermores". Bemused by raven's dissonance, my soul exclaimed, "I seek intelli +gence; Explain thy purpose, or soon cease intoning forlorn 'nevermor +es'!" "Nevermores", winged corvus proclaimed - thusly was a raven named +? Actually maintain a surname, upon Pluvious seashore? I heard an oppressive "nevermore". My sentiments extremely pained, to perceive an utterance so plain +, Most interested, mystified, a meaning I hoped for. "Surely," said the raven's watcher, "separate discourse is wiser. + Therefore, liberation I'll obtain, retreating heretofore - Eliminating all the 'nevermores' ". Still, the detestable raven just remained, unmoving, on sculpture +d bust. Always saying "never" (by a red chamber's door). A poor, tender heartache maven - a sorrowful bird - a raven! O, I wished thoroughly, forthwith, that he'd fly heretofore. Still sitting, he recited "nevermores". The raven's dirge induced alarm - "nevermore" quite wearisome. I meditated: "Might its utterances summarize of a calamity be +fore?" O, a sadness was manifest - a sorrowful cry of unrest; "O," I thought sincerely, "it's a melancholy great - furtherm +ore, Removing doubt, this explains 'nevermores' ". Seizing just that moment to sit - closely, carefully, advancing b +eside it, Sinking down, intrigued, where velvet cushion lay afore. A creature, midnight-black, watched there - it studied my soul, u +nawares. Wherefore, explanations my insight entreated for. Silently, I pondered the "nevermores". "Disentangle, nefarious bird! Disengage - I am disturbed!" Intently its eye burned, raising the cry within my core. "That delectable Lenore - whose velvet pillow this was, heretofor +e, Departed thence, unsettling my consciousness therefore. She's returning - that maiden - aye, nevermore." Since, to me, that thought was madness, I renounced continuing sa +dness. Continuing on, I soundly, adamantly forswore: "Wretch," (addressing blackbird only) "fly swiftly - emancipate m +e!" "Respite, respite, detestable raven - and discharge me, I imp +lore!" A ghostly answer of: "nevermore". " 'Tis a prophet? Wraith? Strange devil? Or the ultimate evil?" "Answer, tempter-sent creature!", I inquired, like before. "Forlorn, though firmly undaunted, with 'nevermores' quite indoct +rinated, Is everything depressing, generating great sorrow evermore? I am subdued!", I then swore. In answer, the raven turned - relentless distress it spurned. "Comfort, surcease, quiet, silence!" - pleaded I for. "Will my (abusive raven!) sorrows persist unabated? Nevermore Lenore respondeth?", adamantly I encored. The appeal was ignored. "O, satanic inferno's denizen -- go!", I said boldly, standing th +en. "Take henceforth loathsome "nevermores" - O, to an ugly Pluto +nian shore! Let nary one expression, O bird, remain still here, replacing mir +th. Promptly leave and retreat!", I resolutely swore. Blackbird's riposte: "nevermore". So he sitteth, observing always, perching ominously on these door +ways. Squatting on the stony bust so untroubled, O therefore. Suffering stark raven's conversings, so I am condemned, subservin +g, To a nightmare cursed, containing miseries galore. Thus henceforth, I'll rise (from a darkness, a grave) -- +nevermore! -- Original: E. Poe -- Redone by measuring circles.


Greetz
Beatnik
... Quidquid perl dictum sit, altum viditur.

Comment on Poe, E.: Near a Raven - Extracting Pi
Download Code
Re: Poe, E.: Near a Raven - Extracting Pi
by Chady (Priest) on Mar 21, 2001 at 19:11 UTC

    good one, ++, you might want to remove the unmatched right curly bracket at line 15


    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
      Heck no! Leave it in! The "Oops" alone got a laugh (and hence a ++) from me! 8)

      Spacewarp

      DISCLAIMER:
      Use of this advanced computing technology does not imply an endorsement
      of Western industrial civilization.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: poem [id://65931]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (14)
As of 2014-12-18 10:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (48 votes), past polls