From: Rob Dixon <rob.di...@gmx.com> > bacoms wrote: > > > > Ho, I wanted to declare an HTML list as a constant array and then > > print it but cannot work out the stntax. > > > > This is what I've coded; > > > > use constant NAVTABSLIST => ["<div id='header'>\n", > > " <ul id='nav-tabs'> > > \n", > > " <li><a > > href='#'><span>Home</span></a></li>\n", > > " <li><a > > href='#'><span>Table</span></a></li>\n", > > " <li><a > > href='#'><span>Chart</span></a></li>\n", > > " </ul>\n", > > "</div>\n"]; > > > > <snipped> > > It would be a lot simpler if you set up a constant list instead of constant > ref > array. > > HTH, > > Rob > > > use strict; > use warnings; > > use constant NAVTABSLIST => ( > "<div id='header'>\n", > " <ul id='nav-tabs'>\n", > " <li><ahref='#'><span>Home</span></a></li>\n", > " <li><ahref='#'><span>Table</span></a></li>\n", > " <li><ahref='#'><span>Chart</span></a></li>\n", > " </ul>\n","</div>\n" > ); > > print NAVTABSLIST;
And is there any reason to have a list in the first place? use constant NAVTABSLIST => <<'*END*'; <div id='header'> <ul id='nav-tabs'> <li><a href='#'><span>Home</span></a></li> <li><a href='#'><span>Table</span></a></li> <li><a href='#'><span>Chart</span></a></li> </ul> </div> *END* print NAVTABSLIST; You can use q{} instead of the here-doc if you like it better. Jenda ===== je...@krynicky.cz === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/