Could someone please glance over this short program to figure out why the last foreach loop is not executing. I realize it's not proper ettiqutte to post the entire progrem but I cannot figure out where the prolem is stemming from, because it worked fine before adding the "strict" option and then declaring everything as local. It's my very first Perl program, so I'm guessing there's something blatantly obvious I've overlooked here.
#!/bin/perl -w
use strict;
use CGI qw(:standard);
opendir IRESDIR, "/export/home/sylvia/ires";
my @iresdir = readdir IRESDIR;
foreach my $dir (@iresdir) {
push (my @dirlist, $dir);
}
closedir IRESDIR;
foreach my $subdir (my @dirlist) {
unless ( $subdir =~ /\.+/ ) {
opendir SUBDIR, "/export/home/sylvia/ires/$subdir";
my @filelist = readdir SUBDIR;
chdir "/export/home/sylvia/ires/$subdir";
foreach my $file (@filelist) {
open IRESFILE, $file;
while (<IRESFILE>) {
if ( $_ =~ /^>gi\|(\d+).*/ ){
push (GILIST, $1);
}
}
close IRESFILE;
}
closedir SUBDIR;
}
}
#####
use Bio::Seq;
use Bio::DB::GenBank;
# creates a general "Sequence object called gb"
my $gb = new Bio::DB::GenBank();
my %specieslist;
my $q = new CGI;
print $q->header,
$q->start_html( -title => "IRES Elements in Species", -bgcolor =>"
+#ffffcc" ),
$q->h2( "IRES Elements Classified by Species" ),
$q->hr;
# creates a specific Sequence object called seq1
foreach my $entry (my @GILIST) {
my $seq1 = $gb->get_Seq_by_acc("$entry") || die "$entry is not a r
+eal accession number.\n";
my $speciesname = $seq1->species->common_name;
unless ($speciesname eq $specieslist{$entry}) {
$specieslist{$entry} = $speciesname;
print p ("Gi# $entry is a $specieslist{$entry} nucleotide sequ
+ence.\n");
}
}
print $q->end_html;
thank you monks!
xxoxooox
speedster