My PERL program seems to only want to run the File_Length subroutine. It always ignores HA_Check and also ignores debugging statements. Any ideas?
# Main &HA_Check || exit; open(OUTFILE, "> $OUTPUT_FILE") || die "Could not open $OUTPUT_FILE fo +r writing: $!\n"; &Outfile_Header; &Errors; &Corrupt; close(OUTFILE); &Clean_Up; exit; # End of main program ## Functions and sub routines # Function to return the number of lines in a file sub File_Length { warn "In 'File_Length'\n"; local($FILE) = chomp($_); $COUNT = 0; open(INFILE, "< $FILE") || die "Can't open $FILE for reading: +$!\n"; while (<INFILE>) { $COUNT += 1; } close(INFILE); $COUNT; } # Function to return the number of files matching the file mask, also # populates $ERR_LIST sub Num_Files { local($MASK, $LIST) = chomp(local($_)); local($NUM_FILES); open(OUTFILE, "ls -la $MASK > $TMP_FILE"); if ($? = 0) { &File_Length($TMP_FILE); while (<OUTFILE>) { $STRING = local($_); ($JUNK, $STORE) = split('.'); open(OUTFILE, ">> $LIST"); print OUTFILE $STORE . "\n"; close(OUTFILE); } close(OUTFILE); } else { $NUM_FILES=0; } $NUM_FILES; } # Function to test which node the script is running on sub HA_Check { if ("`netstat -i | grep -i P01`" == "P01") { return(0); } else { return(1); } }

In reply to Problem with subroutine by coec

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.