{ my @list_in_html = map { "<li$_</li>" } @list; $list_in_html[-1] =~ s!<li>!<li class="last">!; } { my @list_in_html = map { "<li$_</li>" } @list[0.. @list - 2]; push @list_in_html, qq!<li class="last">$list[-1]</li>!; }
In reply to Re: Variant of map for special-casing the last item
by Anonymous Monk
in thread Variant of map for special-casing the last item
by jdporter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |