Dear monks, I wondered if someone could tell me why my very simple program is taking so long to exit after it has printed the results to the screen? Many thanks.
#! /usr/bin/perl -w use strict; my $num_of_params; my $dna1; my $base1; $num_of_params = @ARGV; if ($num_of_params < 2) { die ("\n you havent entered enough parameters! \n"); } open (INFILE, $ARGV[0]) or die "unable to open file"; my @lines = <INFILE>; chomp @lines; $dna1 = join ('', @lines); $dna1 =~ s/\s//g; $dna1 =~ s/^>genome//; @lines = split ('', $dna1); my $count_of_A = 0; my $count_of_C = 0; my $count_of_G = 0; my $count_of_T = 0; my $errors = 0; foreach $base1 (@lines) { if (($base1 eq 'A') || ($base1 eq 'a')) { ++$count_of_A; } elsif (($base1 eq 'G') || ($base1 eq 'g')) { ++$count_of_G; } elsif (($base1 eq 'C') || ($base1 eq 'c')) { ++$count_of_C; } elsif (($base1 eq 'T') || ($base1 eq 't')) { ++$count_of_T; } else { print "There are errors in this DNA sequence. Please check that + your sequence contains only A C T and G\n"; ++$errors; } } print "\nThere are $count_of_A A's in this sequence\n\n"; print "There are $count_of_G G's in this sequence\n\n"; print "There are $count_of_T T's in this sequence\n\n"; print "There are $count_of_C C's in this sequence\n\n"; print "There are $errors errors in this sequence\n\n"; exit;

In reply to programs taking ages to exit by Anonymous Monk

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.