#!/usr/bin/perl use CGI qw(-utf-8 :all *table); use LWP::Simple qw(get); binmode(STDOUT, ":encoding(utf-8)"); print header(-charset=>'utf-8'), "\n", start_html({-title=>'URL retrieval', -author=>'Bob'}), "\n"; if (param('URL')) { my(@words, %count, $word); @words = get(param('URL')); foreach $word (@words) { $count {word} += 1; } foreach $word (keys %count) { print "$word was seen $count{word} times.\n"; } print start_table ({-border=>1}); print("Word Count Statistics for ".param('URL')), "\n"; print caption ("Frequency"); print end_table ; } print h1("URL retrieval"), "\n"; print start_form({-method=>"POST"}); print label("URL: "); print textfield({-name=>'URL', -size=>200}), "\n"; print br(), "\n"; print submit({-name=>'submit', -value=>'Process'}), "\n"; print end_form, end_html;