# 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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |