#!/usr/bin/perl use CGI qw(:standard); use CGI::Pretty; # variables $path = "/mnt/project/nmpdb/public_html/nmpdb/"; # New CGI Object $query = new CGI; foreach my $name ($query->param()) { $submit{$name} = $query->param($name); } # $file = ($submit{'nmp_id'} =~ /HOM/ ? "nmp_db_hom_rel_1_0.txt" : "nmp_db_rel_1_2.txt"); $file = ($submit{'nmp_id'} =~ /HOM/ ? "nmp_db_hom_rel_2_0.txt" : "nmp_db_rel_2_6.txt"); open(F, "<$path" . $file) or die "could not open $file\n"; loop1: while () { if ((/^ID $submit{'nmp_id'}/i) || ($_ !~ /^\/\// && @show)) { push(@show, $_); } elsif (/^\/\// && @show) { push(@show, $_); last loop1; } } close(F); # print HTML header print "Content-type: text/plain\n\n"; foreach my $line (@show) { print $line; }