You are doing a couple things wrong here. As blaze mentioned, you'll need to chomp your input otherwise $file will have a "\n" on the end of it and that'll be assumed to be part of the filename by your open().
You open the file for reading but then you attempt to print to it with your print FILE line. Not only will that fail because your file isn't open for writing, it wouldn't work as you might expect anyway because of the way you are mixing reads and writes. It would be better to write your results out to another file. Even when you use perl's -i flag or $^I variable, it writes the results out to a temporary file first.
You are also closing the file in your continue block.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: File Handle Basics
by sauoq
in thread File Handle Basics
by airblaine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |