Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Applying multiple file modesby afoken (Chancellor) |
on May 25, 2015 at 06:50 UTC ( [id://1127652]=note: print w/replies, xml ) | Need Help?? |
This does not even compile. Post the actual code. Stringifying the file handle in $testfile will give you something like GLOB(0xb03cb8), NOT the filename. This test will always fail. To test if the file is empty, you do not need the -z test at all. You open the file for appending, so the file position is set to the end of the file. This is at position 0 only if the file is empty. tell will tell you the file position, or -1 on error. So, to repair that test:
Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|