#!/usr/bin/perl use CGI qw(:standard); print header,start_html('Sample CGI'); print ""; if (param('dna')){ &print_output(); } else{ &print_form(); } print ""; print end_html; sub print_form{ print "
"; print ""; print " "; } sub print_output{ my $dna = param('dna'); chomp $dna; if ($dna =~ /[^ACGTacgt]/){ print "Sorry !! Your DNA sequence was not valid please enter a valid DNA sequence
"; } else{ print "Your input DNA sequence was $dna
"; $revcom = reverse $dna; $revcom =~ tr/ACGTacgt/TGCAtgca/; # Print the reverse complement DNA onto the screen print "Here is the reverse complement DNA:"; print "$revcom
"; } }