sandmuto has asked for the wisdom of the Perl Monks concerning the following question:
This is still the Finite Automata problem from the University of Zimbabwe isn't it?
In order to read or write from a file, you need to first open a filehandle. Here's a link to the documentation on open.
You output data to a file using the print function. Documentation on print is here.
If you have any further questions, perhaps you could show us the code - we'd then be able to be more help.