in reply to BAsic File I/O

Aside from adding $! to get the systems error message in your die you have a number of other errors.

You don't seem to want printf. print FILE $line will just print out the line to the filehandle FILE. printf in Perl means print formatted and needs the format specified. See perlman:perlfunc for details. Write a bit of C by any chance :-)

Even with print this will still not modify you files as you obviously want to do. This is beacuse you open the file without an input operator. These include < for open for reading > for open for writing and >> for open for appending. See perlman:perlop for more details.

To find the solution you want do a Super Search for "in place edit" in the text and "chipmunk" for the author. You will find Re: modifying a text file on Win32 which does part of what you want. Have a look at the whole thread

Update

This is so common that a snippet seemed in order. This is at Inplace Editing

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print