- Download: perlify.pm
As I walked through the wilderness of this world, I lighted on a certain place where was a den, and laid me down in that place to sleep; and as I slept, I dreamed a dream. I dreamed, and behold, I saw a man clothed with rags, standing in a certain place, with his face from his own house, a book in his hand, and a great burden upon his back. I looked and saw him open the book, and read therein; and as he read, he wept and trembled; and not being able longer to contain, he brake out with a lamentable cry, saying, "What shall I do?"This is a valid Perl script:
use perlify;They are not very different. To convert the text to a working Perl script, I just used perlify.pm and changed some spaces to underscores to prevent the text from calling certain Perl operators without the correct number of arguments. The default action for a word in this text is to print itself and then return 1. The output of the script is
As I walked through the wilderness of this world, I lighted on a certain place where was a den, and laid me down in that place to_sleep; and_as I slept, I dreamed a dream. I dreamed, and behold, I saw a man clothed with rags, standing in a certain place, with his face from his own house, a book in his hand, and a great burden upon his back. I looked and saw him open_the book, and read_therein; and_as he_read, he wept and trembled; and_not being able longer to contain, he brake out with a lamentable cry, saying, "What shall I do?"
world den a was where place certain a on lighted I this of wilderness the through walked I As to_sleep place that in down me laid slept dream dreamed I a dreamed I I and_as behold rags place house hand his in book a own his from face his with certain a in standing with clothed man a saw I back looked I his upon burden great a book open_the him saw read_therein he_read wept he and_as trembled contain cry saying lamentable a with out brake he to longer able being and_notThis example isn't especially creative, but there are ways to embellish it to make it more interesting.
One more thing: if you read perlify.pm, notice a variable named "our $callback". If you care enough to use the module, I probably don't need to tell you what to do with it.
No comments:
Post a Comment