in reply to Anonymous Subroutines

Let me try to give you a different perspective on anonymous subs than you've gotten so far. (Not that what's been written is bad, wrong, or inaccurate; it's all very good stuff. But it's not the whole story.)

Perl allows you to treat functions as first-class data objects -- you can pass them to other functions, return them, store (references to) them, and generate them on the fly. This is difficult to handle with the usual symbol table mechanism (named functions that you call just like builtins), so Perl lets you store (refs to) functions in scalars. This is where you get anonymous functions: functions that aren't in the symbol table.

Here's an example: suppose you're turning Usenet-style text (*bold*, _italics_,, etc) into HTML-style markup. One way to do it would be to write a bunch of conversion functions:

sub translate_bold { ... } sub translate_italics { ... } ...
but that gets tedious pretty quick. Another way (and I'm not saying it's the best way, but it illustrates the point) is to write a function to generate the conversion functions:
sub build_trans { my ($usenet, $tag) = @_; return sub { my ($text) = @_; # do translation here, using $usenet and $tag } }
Then you can keep all the translation patterns in a config file, and build your translation functions on the fly:
while (my $pat = &read_trans_pattern($cfg)) { $trans_funcs{$pat->{'usenet'}} = &build_trans_func($pat->{'usenet'}, $pat->{'tag'}); }
Want to add support for +monospace text+? Thanks to your translation-function builder, all you have to do is add a line to your config file.

This may seem unnecessarily complex, but what it does is keep the complexity in a small part of your code -- the translation-function builder -- rather than spread it out over dozens of functions.