List::MoreUtils mesh or 'zip' function

Viewed 812

So this question is purely for learning purposes and curiosity, but can anyone explain how the function below works?

sub mesh (\@\@;\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@\@) {
    my $max = -1;
    $max < $#$_ && ( $max = $#$_ ) foreach @_;
    map {
        my $ix = $_;
        map $_->[$ix], @_;
    } 0 .. $max;
}

It's from the List::MoreUtils module. I'm using it in one of my applications and I happened to see the source code, and it made me feel like I don't know perl at all! Can anyone explain this craziness? :) Thanks!

1 Answers
Related