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
In reply to Re: transpose AoA and HTML table AoA contents.
by salvadors
in thread transpose AoA and HTML table AoA contents.
by boo_radley
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |