in reply to Issue splitting in while Loop
To add a little emphasis to AnomalousMonk's sage advice: always use strictures (use strict; use warnings; - see The strictures, according to Seuss).
In addition always use three parameter open, lexical file handles and report open errors. Consider:
open my $ranIn, '<', $logFileName or die "Open '$logFileName' failed: +$!\n";
There are at least three important points here. Using a lexical file handle ($ranIn in the sample) reduces the likely hood of a typo in the file handle name resulting in strange and hard to debug runtime errors. Using the quotes around the file name in the die helps see unexpected white space and newlines (commonly from unchomped input data). And the explicit open mode helps avoid errors such as opening a file for input (the default) then trying to write to it, or executing arbitrary user supplied command lines when the file name is supplied at run time.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Issue splitting in while Loop
by koolgirl (Hermit) on Jul 30, 2011 at 03:27 UTC | |
by GrandFather (Saint) on Jul 30, 2011 at 04:04 UTC |