Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: 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.

In reply to Poe, E.: Near a Raven - Extracting Pi by Beatnik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-16 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found