#!/usr/bin/perl use strict; use CGI; my $query = new CGI; if ($query->param("viewsource")) { print "Content-type: text/plain\n\n"; open(SOURCE,"medisinnavn"); while () { print; } } else { print "Content-type: text/html\n\n"; my @ends = qw( amine ophan aline etine ogen anine anol ophlex aphlex ia ane ene ine ite ate ation ose ose ase idine ax il ide ); my @bridges = qw( afro estro iso ama etho ecto endo exo oli orli oxy obo ono ); my @starts = qw( floozy trypto pro proto gyno andro miso poly hemato cyclo pneuma ma toma grappa logi logo lipo deca pneumo chloro fluoro hydro flu contra ); my @vowelmiddles = qw( easter acu at in am eth al orl ornith ox estr ); my @middles = qw( sertr protein plasmic skeletal trypt punct par gen pax clemast hemat mis fromag phenyl prop wank lip foz dextr fruct clem chlor nom chees meth but stat fumar phobic ponic ); my $numsyllables; my $name = ""; my $numwords = $query->param("numwords")||1; for (;$numwords > 0; --$numwords) { my $numsyllables = $query->param("numsyllables")||int( 1 + rand(6)); my @syllables; $syllables[$numsyllables] = $ends[int(rand() * $#ends)]; my $vowel = 1; for ( --$numsyllables; $numsyllables >= 0; --$numsyllables) { my @parts; my $part; if ($vowel) { @parts = (@middles,@vowelmiddles); $part = int(rand()*$#parts); $vowel = ($part > $#middles); } else { @parts = (@starts,@bridges); $part = int(rand()*$#parts); $vowel = ($part > $#starts); } $syllables[$numsyllables] = $parts[$part]; } $name .= (join("",@syllables)); $name .= " " if $numwords>1; } $name = ucfirst($name); if ($query->param("suffix")) { my $suffix = $query->param("suffix"); $suffix =~ s/\-//g; $name .= "-".$suffix; } elsif (rand() > 0.75) { #if (rand() > 0.75) { $name .= "-".chr(65+rand()*26); } my @params = $query->param(); my $querystring = join("&",map {"$_=".$query->param($_)} @params); if ($query->param("mode") eq "xml") { print < medisinnavngenerator /cgi-bin/medisinnavn?mode=xml $name /cgi-bin/medisinnavn?mode=xml EOT } else { print <Automatisk medisinnavngenerator

You need $name



MER MEDISIN!
opsjoner!
stavelser
suffix
antall ord

View source
EOT } }