Make HTML Concise

Tag Functions are Distributive

print li('hi','how','are','you')
<LI>hi how are you</LI>
print li(['hi','how','are','you'])
<LI>hi</LI>
<LI>how</LI>
<LI>are</LI>
<LI>you</LI>

Add HTML Attributes Using Hash References

print li({-type=>'disc'},['hi','how','are','you'])
<LI TYPE="disk">hi</LI>
<LI TYPE="disk">how</LI>
<LI TYPE="disk">are</LI>
<LI TYPE="disk">you</LI>

Script II.1.2: vegetables2.pl

 #!/usr/bin/perl
 # Script: vegetables2.pl
 use CGI ':standard';
 print header,
    start_html('Vegetables'),
    h1('Eat Your Vegetables'),
    ol(
       li(['peas',
	   'broccoli',
	   'cabbage',
	   'peppers' .
           ul(['red','yellow','green']),
           'kolrabi',
           'radishes'])  # <=== typo in your handout!! 
       ),
    hr,
    end_html;

What it Looks Like

http://localhost/cgi-bin/conference/vegetables2.pl
<< Previous Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Mon Aug 17 10:46:14 EDT 1998