Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/usr/local/bin/perl
# open your text file
open(TXT,"<dropdown.txt") or
showError("Failed to open dropdown.txt, $!");
# push each line onto the array
while (my $line = <TXT>) { push @options, $line; }
# close the text file.
close TXT;
# Normal HTML stuff....
# Build the page up to the options of the 'select'
print "Content-type: text/html\n\n";
print "<html><head><title>silly demo page</title></head><body>
<form
action='[URL unfurl="true"]http://www.your_server.com/this_cgi.cgi'[/URL]
method='post'>
<select name='dropdown'>";
# foreach option, print appropriate HTML
foreach (@options) { print "<option>$_</option>\n"; }
# close out the HTML appropriately
print "</select><input type='submit'></form>
</body></html>";
# a sub to shoot errors at the browser. Usually
# cgi errors go to STDOUT which you will never
# see in the browser. This makes trouble shooting
# a lot easier.
sub showError
{
my $e = shift;
print "<p>$e</p></body></html>";
exit;
}