in reply to empty a file
Slightly longer answer: Read perldoc perlopentut and then read perldoc -f open