in reply to head of list + rest of list
Are you sure you don't want to use Lisp? :)
Frank Antonsen had an article about this is The Perl Review 1.1 when he talked about "Functional Programming in Perl".
Besides getting the head and tail of a list, you also have to decide if you want the original array to stay intact.
You can keep the original array as it is with a bit of copying.
my( $head, @tail ) = @array;
my $head = shift @array; my @tail = @array
|
|---|