in reply to Flocking
Why not just open the file for read/write with +<, +>, or +>>?
So you would have
open FILE, "+>>file.txt" or open FILE, "+<file.txt" or open FILE, "+>file.txt"
In Section
Seekers of Perl Wisdom