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

In reply to Help with code by speedo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.