Wednesday, March 18, 2020

Using Perl Chr() and Ord() Functions

Using Perl Chr() and Ord() Functions The Perl programming languages  chr() and ord() functions are used to convert characters into their ASCII or Unicode values and vice versa. Chr() takes an ASCII or Unicode value and returns the equivalent character, and ord() performs the reverse operation by converting a character to its numeric  value.   Perl Chr() Function The chr() function returns the character represented by the number specified. For example: #!/usr/bin/perl print chr (33) print /n; print chr (36) print /n; print chr (46) print /n; When this code is executed, it produces this result: ! $ Note: The characters from 128 to 255  are by default not encoded as UTF-8 for backward compatibility reasons. Perls Ord() Function The ord() function does the opposite. It takes a character and converts it into its ASCII or Unicode numeric value. #!/usr/bin/perl print ord (A); print /n; print ord  (a); print /n; print ord  (B); print /n; When executed, this returns: 65 97 66 You can confirm the results are accurate  by checking an ASCII Code Lookup Table online. About Perl Perl was created in the mid-80s, so it was a mature programming language long before websites exploded in popularity. Perl  was originally designed for text processing, and it is compatible with HTML and other markup languages, so it quickly became popular with website developers. Perls strength lies in its ability to interact with its environment and its cross-platform compatibility. It can easily open and manipulate many files within the same program.

Monday, March 2, 2020

Alfred, Lord Tennyson Poems

Alfred, Lord Tennyson Poems The poet laureate of Great Britain and Ireland, Tennyson developed his talent as a poet at Trinity College, when he was befriended by Arthur Hallam and members of the Apostles literary club. When his friend Hallam died suddenly at the age of 24, Tennyson wrote one of his longest and most moving poems In Memoriam. That poem became a favorite of Queen Victorias.   Here are some of Tennysons best-known poems, with an excerpt from each one.   The Charge of the Light Brigade Perhaps Tennysons most famous poem, The Charge of the Light Brigade contains the quotable line Rage, rage against the dying of the light. It tells the historical story of the Battle of Balaclava during the Crimean War, where the British Light Brigade suffered heavy casualties.The poem begins: Half a league, half a league,Half a league onward,All in the valley of DeathRode the six hundred. In Memoriam Written as a eulogy of sorts for his great friend Arthur Hallam, this moving poem has become a staple of memorial services. The famous line Nature, red in tooth and claw, makes its first appearance in this poem, which begins: Strong Son of God, immortal Love,Whom we, that have not seen thy face,By faith, and faith alone, embrace,Believing where we cannot prove A Farewell Many of Tennysons works are focused on death; in this poem, he ponders how everyone dies, but nature will continue after were gone. Flow down, cold rivulet, to the seaThy tribute wave deliver:No more by thee my steps shall beFor ever and for ever Break, Break, Break This is another Tennyson poem where the narrator is struggling to express his grief about a lost friend. The waves break relentlessly on the beach, reminding the narrator that time moves on. Break, break, break,On thy cold gray stones, O Sea!And I would that my tongue could utterThe thoughts that arise in me. Crossing the Bar This 1889 poem uses the analogy of the sea and the sand to represent death. Its said that Tennyson requested this poem be included as the final entry in any collections of his work after his death.   Sunset and evening star,And one clear call for me!And may there be no moaning of the bar,When I put out to sea, Now Sleeps the Crimson Petal This Tennyson sonnet is so lyrical that many songwriters have tried to put it to music. It ponders, through the use of natural metaphors (flowers, stars, fireflies) what it means to remember someone.   Now sleeps the crimson petal, now the white;Nor waves the cypress in the palace walk;Nor winks the gold fin in the porphyry font:The fire-fly wakens: waken thou with me. The Lady of Shalott Based on an Arthurian legend, this poem tells the story of a lady who is under a mysterious curse. Heres an excerpt: On either side the river lieLong fields of barley and of rye,That clothe the wold and meet the sky;And thro’ the field the road runs by The Splendour Falls on Castle Walls This rhyming, lyrical poem is a somber reflection on how one is remembered. After hearing a bugle call echo around a valley, the narrator considers the echoes that people leave behind.    The splendor falls on castle wallsAnd snowy summits old in story;The long light shakes across the lakes,And the wild cataract leaps in glory. Ulysses Tennysons interpretation of the mythological Greek king finds him wanting to return to traveling, even after many years away from home. This poem contains the famous and oft-quoted line   To strive, to seek, to find, and not to yield. Here is the opening to Tennysons Ulysses. It little profits that an idle king,By this still hearth, among these barren crags,Match’d with an aged wife, I mete and doleUnequal laws unto a savage race