in reply to Using $"

Tip #1 from the Basic debugging checklist: warnings

Filehandle INFO opened only for input at ...

diagnostics:

Filehandle INFO opened only for input at ... (W io) You tried to write on a read-only filehandle. If you inten +ded it to be a read-write filehandle, you needed to open it with "+<" +or "+>" or "+>>" instead of with "<" or nothing. If you intended onl +y to write the file, use ">" or ">>". See perlfunc/open.

Replies are listed 'Best First'.
Re^2: Using $"
by Bugz (Acolyte) on Dec 22, 2014 at 20:02 UTC
    I tried "+<" and noticed that all but the first line had the # appended to it. Also instead of replacing the line in the file, the values were added to the end
    D:\Perl_Samples>perl -w file_Modify.pl Alpha Beta Chi Delta EpsilonAlpha #Beta #Chi #Delta #Epsilon
Re^2: Using $"
by Bugz (Acolyte) on Dec 22, 2014 at 19:57 UTC
    I have tried to use "+>>" and ">>" to no avail.

      The second time you open the file, it needs to be opened for output.

      open(INFO1, ">", $file) or die "Couldn't open: $!\n";

      It looks like you are using $" correctly so your question should probably be something about reading and writing to files. There are many tutorials on this topic for Perl.