|
Little
Acts of Magic
Randal L. Schwartz
So, let's start with some text manipulation. I have a poem written by a good
friend of mine, Peg Edera, in a file named peg_poem, as follows:
The Little Acts
Maybe there is no magic.
Maybe it is only faith.
The lonely girl stuffs a letter
In a bottle, casts it in the sea.
It floats, it sinks.
What counts is that it's cast.
Those little intentions,
The petals placed on the altar,
The prayer whispered into air,
The deep breath.
The little acts,
The candles lit,
The incense burning
And we remember what counts
And we know what we need
In the little acts.
Then is when to listen.
What is it that brought you
To this?
There's the magic.
Right in hearing what
Sends you to
Hope.
Peg Edera
February 8, 2000
The title of her poem inspired the theme of this column, so it's only appropriate
that we use the text as grist for the mill.
Let's start with the basics of opening the file and reading. That'd be something
like:
open POEM, "peg_poem" or die "Cannot open: $!";
while (<POEM>) {
... do something here with each line
}
Within the body of this while loop, $_ contains each line from the
poem. So on the first iteration, we get The Little Acts and a new line,
and so on.
If we just want to copy the data to STDOUT, a simple print will
do:
# open..
|