in reply to transpose AoA and HTML table AoA contents.

A few comments on this.

Firstly, when you're going to do a nested map like that, I don't think there's a lot of ways around using a temporary variable if you need to access $_ from both maps. If there is I'd like to know it, as I've had to do some of this recently. Perhaps someone with a more functional background can show a few cool tricks here?

Secondly, you don't want to be using local so much. You want "my" instead. You can read the reasons why at Dominus' great Coping With Scoping article.

Also, you don't need to use the double map to print your HTML. From the manual for CGI:

THE DISTRIBUTIVE PROPERTY OF HTML SHORTCUTS

One of the cool features of the HTML shortcuts is that they
are distributive.  If you give them an argument consisting of
a reference to a list, the tag will be distributed across each
element of the list.

So, instead of print table(map{Tr(map{td($_)}@$_)}@l_array) you can just use

print table( Tr([ map { td([ @$_ ]) } @a ]) );

Tony

Replies are listed 'Best First'.
Re: Re: transpose AoA and HTML table AoA contents.
by jeroenes (Priest) on Jan 12, 2001 at 13:24 UTC
    ++ for salvadors. The table-print can be made shorter, though:
    print table( Tr( map { Td( $_ ) } @a ) );
    Since you don't need to dereference anything with CGI. But I didn't know that until I grogged that manual-quote by your posting. Thanks!

    Jeroen
    I was dreaming of guitarnotes that would irritate an executive kind of guy (FZ)