open(LOG, "+>$logFile") || die "Can't open logfile: ($!)\n"; print LOG "Begin data collection for $host - Runs: $numRuns\n"; for ($run = 1; $run <= $numRuns; $run++) { print LOG "Starting run $run\\$numRuns - "; snmpRun(); unless ($run == $numRuns) { sleep("$pauseTime"); } } #### sub snmpRun { ... print LOG "In: $octetInUtil Out: $octetOutUtil Time: $time\n"; ... }