in reply to Openind file for read+append

I would simply open the file for writing, seek() to wherever you need to go, then write.

Replies are listed 'Best First'.
Re^2: Openind file for read+append
by jaldama (Acolyte) on Feb 09, 2012 at 18:45 UTC

    I'm having trouble matching strings in the file I'm opening. I just have it opening the file for reading now, because I"m trying to figure out what is going wrong. Is there something obvious that I am missing? It never matches the string on that file even though it IS there.

    open FILE,'/Users/j/Desktop/test.log'; while (<FILE>) { chomp; #check for duplicate file if ($_ =~ m/appending/) { print "Looks like the data you entered is already on file\n"; close (FILE); } else { print "hey hey success\n"; close (FILE); &append; } }