You use both -w and use warnings. They
both do pretty much the same thing so only one is
needed.
Your while condition can be better written
as while (<FILE>).
Rather than opening specific input and output files,
your script would be more flexible if you read from STDIN
and write to STDOUT. You could then call your script using
IO redirection. myscript.pl < input.dat > output.txt