Perl Paraphernalia

Mark Jason Dominus


Please Boycott Amazon
More Information

Perl Paraphernalia de Mark-Jason Dominus. Esta página no es apta para "todo público"; se han visto adultos romper en llanto luego de leer durante cinco minutos . Aquí encuentran lo que ocurre cuando un experto en lenguajes de programación y semántica denotacional entra en contacto con el^H^Hun lenguaje más^H^H^Htan poderoso.
-- Caracas.pm mailing list

Last Change:
8 May 2003


History of changes to my pages, including this one.

Legend

**NEW** Added in the last four weeks.
**UPDATED** Updated in the last four weeks.
**COMINGSOON** Don't hold your breath.

Complete List of Perl Paraphernalia

Perl Advanced Techniques Handbook

Articles for The Perl Journal

This area contains text, source code, and notes about my column in The Perl Journal. As new articles appear, I'll add them here.

Autumn 1997: Infinite Lists

Winter 1997: B-Trees

Spring 1998: How Regexes Work

How do Perl's regexes work on the inside? Suppose you were going to write a language like Perl, which has regexes, in a language like C, which doesn't? How might you do that?

Regex article main page

Regex article notes and errata page

Summer 1998: Ray Tracing

Ray tracing is one of the most flexible and versatile methods of rendering three-dimensional computer images. In this article, I show you a simple ray tracing program written in Perl and explain how it works.

Ray Tracing main page

Summer 1998: Just the FAQs: Understand References Today

One of the most important new features in Perl 5 was the capability to manage complicated data structures like multidimensional arrays and nested hashes. To enable these, Perl 5 introduced a feature called `references', and using references is the key to managing complicated, structured data in Perl. Unfortunately, there's a lot of funny syntax to learn, and the manual is not as clear in this area as it usually is. The manual is quite complete, and a lot of people find that a problem, because it can be hard to tell what is important and what isn't.

Fortunately, you only need to know 10% of what's in the manual to get 90% of the benefit. This article will show you that 10%.

Autumn 1998: Just the FAQs: Suffering From Buffering?

The deadline for written materials for The Perl Conference got in my way, so I wasn't able to do two articles again this issue. I put my regular Bricolage column on hold and wrote another article for novices. It's about how stadard I/O buffering works and shows typical traps and hazards and how to avoid and remedy them. I think even experienced programmers will learn something from it.

If you're sad that you missed my regular Bricolage column because it was on vacation, then seeing the notes for my conference talk might make you feel better.

Winter 1998: Just the FAQs: Coping with Scoping?

This article discusses issues of variable scope and duration in Perl, including packages, namespaces, and the difference between my and local. The Big Secret: Perl has two separate and totally unrelated sets of variables.

Winter 1998: Bricolage: Data Compression

This article discusses how data compression works. It comes with a module, Huffman, which implements a simple data compression scheme in Perl.

Spring 1999: Bricolage: Memoization

Caching is a straightforward way to speed up certain slow functions: You remember the return values by storing them in a cache, and if you are going to compute the same value again later, just get the result from the cache instead of recomputing it. It turns out it's not hard to build a facility that replaces any function with a caching version automatically; this is called memoization. This article explains how such a module works, and shows a number of interesting applications and contexts for memoization and caching.

Summer 1999: Seven Useful Uses of local

In my article Coping With Scoping I offered the advice ``Always use my; never use local.'' The most common use for both is to provide your subroutines with private variables, and for this application you should always use my, and never local. But many readers (and the tech editors) noted that local isn't entirely useless; there are cases in which my doesn't work, or doesn't do what you want. So I promised a followup article on useful uses for local. That is what this article is about.

Autumn 1999: Just the FAQs: Precedence Problems

I wrote a tutorial article about what precedence is and how it works in Perl.

Read the Article

I also wrote a review of Perl 5 For Dummies, by Paul Hoffman, published by IDG books. The review was quite a surprise to me; it didn't turn out the way I expected at all.

Other Articles

For IEEE Software

I wrote an article for IEEE Software magazine; it's their first-ever article about Perl. It appears in Vol. 15, #1 (the January / February 1998 issue) pages 69-74.

It's partly an introduction to the language for people who have never seen it before, and partly a big boast about how great Perl is. I'm not sure I believe that Perl is as great as I made it out to be, but I do think it's pretty good.

Read the plain text of my last draft, or get a PDF copy of the published version from The Computer Society (Computer Society members only).

Modules

Text::Template

Current version: 1.41. Last update: 2001-09-04.

Memoize

Current version: 0.61. Last update: 2000-10-24.

The Memoize module will make your functions faster by remembering their old values and reusing them instead of recomputing the same thing twice. It is very easy to use. Very very easy. Step 1: Say memoize('some_function'). Step 2: There is no step 2. I told you it was easy.

Interpolation: Why Identity wasn't as funny as I thought.

Current version: 0.53. Last update: 1998-04-09.

This module lets you define arbitrary string interpolation semantics, which means that you can control the way variables and other expressions interpolate into your strings. Perl already provides \L...\E and \U...\E to say that a string should be put into lowercase or uppercase when it's interpolated; Interpolation extends this notion. The notation is compact and readable, and you can have as many interpolators as you want.

Stat::lsMode

Current version: 0.50. Last update: 1998-04-20.

Stat::lsMode is a module for displaying file permission modes in the style of the UNIX ls -l command. For example, a plain file that is world-readable and writable only by its owner is represented by the string -rw-r--r--.

Locked

Current version: 0.1. Last update: 1999-02-03.

Locked is a module for providing scalar variables that can be locked and unlocked. Unlocked scalars behave normally. Locked scalars abort the program if you try to assign to them. Variables can be locked and unlocked; you can also test them to see if they are locked or not.

It's also a fine demonstration of the power of tie

I just wrote this, so there's little documentation and no test suite yet.

Perl Stupidity


Identity: A Very Funny Module

This is one of the funniest pieces of software I have ever written. It is an absolute riot. And it is even possibly useful. It is called Identity, but I am looking for a better name. If you want to know why it's useful, it will help to read the explanation first.

Addition is possibly the stupidest Perl program ever written.

I don't really believe that it is the stupidest. In fact, you should watch this space for the sudden appearance of other stupid programs. But it sure is mighty stupid though.

Roman is a new contender for stupidest Perl module ever written.

This one may give Addition a run for its money, if only because it takes so darn long to load.

allsubs is a stupid module that might actually be useful.

Following a suggestion of Alex Davies, this module tries to automatically locate and declare all your subroutines at compile-time, so that you don't have to do it yourself.

Read the notes and then scrutinize the code.

Other Paraphernalia and Miscellanea

Perl Regex Matching is NP-complete

Sometimes Perl can take a very long time to evaluate a regular expression match. Is this a problem with Perl's implementation of regexes? The answer is no; this paper shows that regex matching in Perl is NP-complete. This means that if you could come up with an efficient way to evaluate regex matches in Perl, you would become very famous because your method would also be an efficient way to solve many other well-known and difficult problems.

Usenet Articles

Why Questions go Unanswered

Someone on comp.lang.perl.misc wanted to know why nobody was answering his questions. In answer, I wrote an article about how to ask a question so that it'll get an answer.

What is `Scalar Context'?

Why doesn't print reverse $x work? And what is `Scalar Context'? And what is the scalar builtin function for? This short article explains contexts and the scalar function.

Why it's stupid to `use a variable as a variable name'

People show up in comp.lang.perl.misc all the time asking how to use the contents of a variable as the name of another variable. For example, they have $foo = 'snonk', and then they want to operate on the value of $snonk. This anecdote suggests that is probably a bad idea, and explains what you should probably be doing instead.

This follow-on article goes into more specifics about the sorts of things that can go wrong, and what to do instead.

Is there no end to this topic? No, apparently not.

When Hashes Go Wrong

This program demonstrates what happens When Hashes Go Wrong. It accepts one command-line argument, N, which defaults to 10,000. It then constructs N strings and uses them as keys for the hash. The strings are constructed so that their hash values are all the same, so they all go into one hash bucket. This turns the hash search into a linear search---very slow.

Perl has one small win here. Normally, Perl increases the number of buckets as the number of items in the hash increases. If it did that here, it would be wasting time and space, since this program only uses one bucket. But fortunately for Perl, this program doesn't trigger the condition that makes Perl expand the hash: Perl only does that when a key is inserted into a previously empty bucket.

A Program to Write YACClike Parsers in Perl

This program, py, implements LALR(1) parsers in Perl. These are the sorts of parsers produced by YACC and Bison. But the program is a complete oddity. Find out why.

Perl, 1967 edition

It occurred to me today that there was a language I'd heard about before that sounded a lot like Perl. I looked it up, and sure enough, it sounded just like someone in 1967 describing Perl. You can read the description of Perl '67 and try to guess what language is really being described.

Over the next few weeks I hope to research this language and learn whether it really does resemble Perl as much as it seems to. If so, it could be a valuable example lesson that could teach us a lot about how to develop Perl and what sorts of mistakes to avoid.

Perl Paraphernalia Links

If you hated this page, you'll probably also dislike:

I'd be glad to get other people's recommendations of other pages of Perl Paraphernalia.


Search Perl Paraphernalia

Google


Software entities are more complex for their size than perhaps any other human construct because no two parts are alike. If they are, we make the two similar parts into a subroutine -- open or closed. In this respect, software systems differ profoundly from computers, buildings, or automobiles, where repeated elements abound.

Fred Brooks, Jr.


Return to: Universe of Discourse main page | What's new page

mjd@plover.com

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.