in reply to list assignment in scalar context

Personally I love this kind of stuff. Its a nice combination of the elegance of the functional (LISP, ML) paradigm and your more standard brute-force imperative/side-effect paradigm. You assign/pattern-match the array returned from each (functional), then the while statement uses the side effect value produced when it reduces the values in its conditional clause to a scalar value (imperative/side-effect). This is as close as Perl comes to a pattern matching syntax for functions (pattern matching != reg-ex in this context). Which, IMHO is one of the coolest peices of syntactic suger out there.

Consider this ML code for finding the length of a list:

fun length [] = 0 | length (head::tail) = 1 + length tail;
The first version of the length function is for empty lists (hence the []). The second version (after the | character) matches the head (the first element) of the list and the tail (the rest of the list). (The "::" is actually ML's list operator, and far to esoteric to explain here). The equivalent Perl would be:
sub length { return 0 unless @_; # manual pattern matching of the array here my ($head, @tail) = @_; return 1 + length(@tail); }

Or this (oh so cool) Erlang code for testing list membership:

member (X, []) -> false; member (X, [X|_]) -> true; member (X, [_|T]) -> member(X, T).
Erlang uses the "_" (underscore) to mean "A variable whose value i dont care about", and all variables can only be assigned to once and must begin with capital letters (its a language for real-time systems, so it is strict like this for good reason). This function can be read like this:

Erlang evaluates this function by moving down the argument-lists/guard-clauses, and runing the body of the function that best matches the actual given arguments. If you think this looks kinda like Prolog, it does, the original Erlang interpreter was written in Prolog.

It is not hard to do an equivalent of this in perl, it would roughly be this:

sub member { my ($X, $head, @tail) = @_; return 0 unless defined($head) && scalar @tail; return 1 if $X == $head; return member($X, @tail) if $X != $head; }
Sure, all this Perl code is recursive, and therefor not terribly efficient. But the Erlang and ML code is compiled in such a way that they are efficient. ML can reach C-like speeds at times, and Erlang can get up there too.

IMHO Perl is one of the coolest langauges out there; its very multi-paradigm, super-flexible in syntax and you can you can open it up and play with its guts (symbol tables, the B modules, etc etc) without "voiding the warranty" :). A very nice combination.

-stvn

NOTE: The ML and Erlang code are not mine, stole them from 2 very cool books. Concurrent Programming in Erlang and ML for the Working Programmer.