Keep It Simple, Stupid | |
PerlMonks |
Re: Useless use of private variable in void context atby GrandFather (Saint) |
on Nov 23, 2014 at 22:13 UTC ( [id://1108187]=note: print w/replies, xml ) | Need Help?? |
You are using a C style for loop. The first element of the for loop header is an initialization statement, but $i doesn't actually do anything - it is a variable used in a silly place (void context) because the value isn't used there. But, you'd be much better to use a Perl loop:
which makes what is going on much clearer. But for your particular problem you could:
Note the three parameter open, lexical file handle and a check that the open succeeded.
Perl is the programming world's equivalent of English
In Section
Seekers of Perl Wisdom
|
|