May 19, 2010, 5:57 AM
Post #7 of 7
Why aren't you using a lexical var and the 3 arg form of open or the $! in the die statement like I showed?
Re: [ym_chaitu] commands not running
[In reply to]
Yes, glob will work, but should not be done directly in the open call. Instead, you should assign its results to a var and use that var in the open call and die statement.
Instead of slurping the file into an array and looping over that array with a foreach loop, it would be better and more efficient to use while to loop over the filehandle.
$line should be declared in the smallest scope that it requires, which is inside the while (or foreach) loop.
Do not quote single vars. See `perldoc -q quoting`: http://perldoc.perl.org/perlfaq4.html#What%27s-wrong-with-always-quoting-%22$vars%22?
(This post was edited by FishMonger on May 19, 2010, 5:58 AM)