Best viewed with a modern CSS2-compliant browser, such as Mozilla Firefox.

Data::Alias

Data::Alias (download) is the most significant module I've written so far. It introduces a modifier which temporarily changes the semantics of many operations to use aliasing instead of data copying.

The basic syntax is very simple: alias EXPR or alias BLOCK will evaluate the expression or block with aliasing semantics, and returns its result. Some basic examples can be seen in the synopsis of the documentation.

Aliasing semantics

So what exactly do aliasing semantics mean? In simple terms, it means that whereever a value would normally copied from a source to a destination, instead a change is made that ensures that the expression used to specify the destination now points to the source.

The simplest case possible is the following:

alias $x = $y;
$y = 42;
print $x;

This prints 42, because the use of alias has not just copied the value of $y to $x, but it has actually made the name '$x' point to the same variable as $y does, hence any later change to $y is also seen via $x.

In this trivial case this may not seem very useful, but consider for example:

if ($x[$i][0]{value} == 0) {
	$x[$i][0]{value} = $DEFAULT_VALUE;
} else {
	$x[$i][0]{value} = abs $x[$i][0]{value};
}
... versus ...
alias my $value = $x[$i][0]{value};

if ($value == 0) {
	$value = $DEFAULT_VALUE;
} else {
	$value = abs $value;
}

Proper use of aliasing can help a lot with readability. Note that this is effectively the same as using for my $value ($x[$i][0]{value}) but using alias is clearer and faster.