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 > columns > Perl Advisor
 Perl Advisor   Randal L. Schwartz 

Commonly Used Parsing Techniques November 2004
I write a lot of Perl code that contains a significant amount of text parsing -- to find the interesting bits of the text (data reduction) or to break the text into pieces (lexical analysis). In this column, I'll show how I use regular expressions to accomplish those tasks.

  


 

Strictly Speaking about "use strict" September 2004
In many of my writings about Perl, I give the strong admonition to place use strict at the beginning of the program. I've often explained the line with a few short phrases, but I thought it would be interesting to focus on this one construct in detail for a change.

Lightweight Persistent Data July 2004
Frequently, you have data with a strong will to live. That is, your data must persist between invocations of your program and occasionally even be shared between simultaneous invocations.

DTrace — Most Exposing Solaris Tool Ever June 2004
DTrace is a powerful new tool that's part of the Solaris 10 release and is available in pre-release via the Software Express for Solaris mechanism discussed in the April 2004 Solaris Companion. Because it is unique, DTrace is a bit difficult to describe. In this column, I'll summarize the features of DTrace, but I'll leave it to the Solaris kernel engineers who wrote DTrace to explore it with me in a series of questions and answers. I think that by the time you are finished hearing the engineers talk about DTrace, and once you experience it yourself, you'll agree with me that it's a brilliant piece of work that adds greatly to the ability to understand the workings of Solaris.

Constructing Objects May 2004
To construct an object in Perl, you must select a valid package name for the object's class, populate that package with subroutines to define the methods, set the value of @ISA within that package to define the base (parent) classes for that class, and then create a blessed reference.

The Software Express from Sun April 2004
There was a time when Sun customers could receive SunOS on floppies -- lots and lots of floppies. Loading that version was not much fun. Then Sun began allowing customers to download current versions of Solaris. And now, Sun has added to the fun by enabling downloads of "snapshots" of future Solaris releases. The Software Express for Solaris (SX) program allows existing Sun customers to download an evolving release of Solaris. While writing three CDs worth of downloads may not seem like fun to some, those of us who like experimenting with new features and evaluating new functions now have a new way to have a great time.

Monitoring Net Traffic with OpenBSD’s Packet Filter March 2004
The server for stonehenge.com lives somewhere in Texas, in a place I've never seen. I rent a box from Sprocket Data Systems, and they provide my remote eyes and ears, and hook me up to their networks and power grid. I'm limited to a certain bandwidth each month for the rate I pay, and to offset the costs, I also sublease the box to geekcruises.com and redcat.com.

Sharing Open Source Code Through the CPAN January 2004
The Comprehensive Perl Archive Network (CPAN) is a wonderful place, full of contributed items for you to use, such as scripts and modules. Modules are the core of the CPAN: little building blocks for you to include into your applications.

Speeding up Your Perl Programs November 2003
How fast does your Perl run? I hope that, most of the time, the answer is "fast enough". But sometimes it may not be. How do we speed up a Perl program? How do we know what's making it unacceptably slow?

Computing Securely September 2003
Security is everybody's business. You may ask yourself, "Why should I take security seriously? I don't have anything on my system that's worth exploiting." Well, that's exactly what the bad guys want you to believe.

The Simplicity of Sockets July 2003
The Internet connects people to other people and to services. These connections are made with applications talking to each other on separate machines, over various media such as Ethernet, dialup, and 802.11b wireless. These applications, in turn, are using a simple but powerful tool called a "socket" to provide the datastream between them. In this column, I'll look at sockets and how to describe and use them.

Variables and Scoping May 2003
Programs push data around. In Perl, this data lives in variables, and the variables can be associated with various scopes. Let's take a look at Perl's peculiar scoping rules.

The Duct Tape of the Internet January 2003
When you’re a Perl programmer, you never fret about those little ugly tasks that creep up. Perl can deal with file wrangling, text manipulation, and process management in a way unequaled by any other single language, whether open source or proprietary.

Automatically Extending Your Data November 2002
Perl is great at parsing data and bringing it into memory-based data structures for reformatting or analysis (“data reduction”). One of Perl’s features that permits relatively easy creation of complex data structures is “auto-vivification” — a mouthful to say, but it roughly means “data structures get expanded as necessary”.

Finding Old Things September 2002
One of the great things about the Perl community is seen in the many ways that Perl information can be obtained to solve typical tasks or to get past those sticky little problems. Besides the professional documentation, there’s also the myriad of man pages that come with the Perl distribution itself, and the CPAN modules. And with a little searching on the Net, you can quickly find very active support for Perl in the way of Usenet newsgroups, mailing lists, and a few Web communities.

Parsing and Summarizing a Logfile July 2002
I recently put www.stonehenge.com behind a caching reverse-proxy, and rather than switch technologies, I’m using another instance of a stripped-down Apache server to do the job. But what kind of job is it doing? How many of my hits are being cached and delivered by the lightweight front servers, instead of going all the way through to the heavy mod_perl_and_everything_else backend servers?

Parsing Interesting Things   December 2001
Someone recently popped into one of the newsgroups I frequent and asked how to parse an INI file. You might have seen those before, with sections and keyword=value lines, like:

[login]
timeout=30
remote=yes

[password]
minlength=6
          
I think they started in the Microsoft world, since no sane UNIX hacker would have come up with something like that.

Developing a Perl Routine  August 2001
I was cruising the Perl newsgroups the other day, and found the following request. It appears to be a homework problem from a university assignment, so I won’t embarrass the original poster by including his name. (Normally, I try to give credit to the source of inspiration for one of my columns, so if you want your name in lights, please email your ideas to me!)

It's All About Context  June 2001
Randal's advice: When hacking Perl, get the text right. Don't let a context-sensitive Perl operator land you in jail.

Perl Advisor: A MIME Is a Terrible Thing to Waste  April 2001
Using MIME::Tools, Schwartz combats spam by creating a Perl filter that recognizes HTML email and strips the HTML fork.

What is That, Anyway? February 2001
Have a directory full of stuff you don't remember? Perl has many built-in operators to help you figure out what it is.

So What's the Difference? December 2000
A lot of common programming is dealing with things that change. Things do indeed change, and sometimes we'd like to know how they changed.

Little Acts of Magic  October 2000
When it comes to text manipulation, Perl can perform virtual acts of magic.

Taint so Easy, Is It?  August 2000
If you've been reading my columns for any length of time, you've probably seen me mention "taint mode", usually briefly while I'm describing a "hash-bang" line of something like: #!/usr/bin/perl -Tw

Getting It to Look the Way You Want   June 2000
For the most part, Perl programmers tend to use the nice standby print operator for output, or drift occasionally into the realm of formats to quickly lay out a look for a customized report. However, the often overlooked printf operator provides a nice amount of custom control to get those output strings to look exactly the way you want.

Rainy Day Template Fun   April 2000
I grew up (and still reside) in Oregon, well known for having rain nearly all parts of the year. However, the months around April seem to have been particularly wet, and as a child, I'd often end up doing "indoor" activities during the heaviest rainy days.

Deep Copying, not Deep Secrets February 2000
One of the modules I encountered in the CPAN had a problem with creating multiple objects. Each object was created fine, but on further use simultaneously in the program, some of the data from one object mysteriously showed up in the second one, even if the first one was freed!

Figuring Phone-y Words December 1999
Every day, we seem barraged with phone numbers that “spell” things, like “please dial 1-ZZZ-HE-MUST-PAY to force your older brother to pay for the call!”. That's because since nearly day one of dial phone service (back when it was really a dial), we've had these letters that go along with each of the digits.

Compiling Regular Expressions October 1999
Perl's regular expressions set Perl apart from most other scripting languages. Some features (like the positive and negative lookahead, and the optional lazy evaluation of multipliers) make matching troublesome strings trivial in Perl.

The Missing Symlink August 1999
Symbolic links were not present in the first version of UNIX that I used. That would be UNIX V6, back in 1977, when the UNIX kernel size was under 32K. It's hard to imagine anything under 32K being associated with UNIX these days.

 
About Randal

Randal L. Schwartz is a two-decade veteran of the software industry -- skilled in software design, system administration, security, technical writing, and training. He has coauthored the "must-have" standards: Programming Perl, Learning Perl, Learning Perl for Win32 Systems, and Effective Perl Programming, as well as writing regular columns for WebTechniques and Sys Admin magazines. He's also a frequent contributor to the Perl newsgroups, and has moderated comp.lang.perl.announce since its inception. His offbeat humor and technical mastery have reached legendary proportions worldwide (but he probably started some of those legends himself). Randal's desire to give back to the Perl community inspired him to help create and provide initial funding for The Perl Institute (perl.org). He is also a founding board member of the Perl Mongers (pm.org), the worldwide association of "Perl users groups". Since 1985, Randal has owned and operated Stonehenge Consulting Services, Inc.




MarketPlace

Instant Answers to Your IT & Business Questions
Sign Up & Get Full Access To The Definitive Online Book Collection With SkillSoft's Books24x7�.

NEW! Numara FootPrints 9 - Service Desk Management
IT Service Management that Delivers. Real Value. Real Flexibility. Real Results. Free Demo.

BugSplat - Automatic Crash Analysis
Fast online exception analysis. Capture customer crash data online.

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.

Wanna see your ad here?