Using CGI.pm for the Cosmids Script

Here's the process cosmids script rewritten to take advantage of CGI.pm.

Code:


  #!/usr/bin/perl -w
  # file: process_cosmids2.pl

  use strict;
  use CGI ':standard';

  my $COSMIDS = '/net/share/cgi/cosmids.txt';
  my $URL     = 'http://www.wormbase.org/db/get?class=Sequence;name=';

  open (COS,$COSMIDS) or die "Can't open cosmids file: $!\n";
  my @list_items;
  while (my $cosmid = <COS>) {
     chomp $cosmid;
     push @list_items,a({-href=>"$URL$cosmid"},$cosmid);
  }

  print header(),
        start_html('Cosmids'),
        h1('Cosmids'),
        ol(
          li(\@list_items)
        ),
        end_html;

http://your.site/cgi-bin/process_cosmids2.pl


<< Previous
Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Tue Oct 23 19:25:00 EDT 2001