Current Issue


Table of contents

CD-ROM

Sys Admin and The Perl Journal CD-ROM version 12.0

Version 12.0 delivers every issue of Sys Admin from 1992 through 2006 and every
issue of The Perl Journal from 1996-2002 in one convenient CD-ROM!

Order now!

Sys Admin Magazine > Archives > 2000 > 0010

Page artLittle 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..

				  



MarketPlace

Flowcharts from C/C++ code -- Free trial download
Understand C/C++ code in less time. A new team member ? Inherited legacy code ? Get up to speed faster with Crystal Flow for C/C++. Code-formatting improves readability. Flowcharts are integrated with code browser. Export flowcharts to Visio.

Automate Software Builds with Visual Build Pro
Easily create an automated, repeatable process for building and deploying software.

WinDev 12 - Powerful IDE
Develop 10 times faster ! ALM, IDE, .Net, RAD, 5GL, Database, 5GL, 64-bit, etc. Free Express version

Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.

Wanna see your ad here?