How do I insert a line in a file to the beginning of a file in Perl? -


i used perl helper code this. looks missing character or something. need write new text top of text file.

open (logfile, ">> complete.txt") ; # writes new bottom  $datetime = localtime ;  print logfile "\n" ;  print logfile $datetime\n" ; print logfile "$name\n" ; print logfile "has completed work\n" ;  close (logfile) ; 

this answered in perl faq.

how change, delete, or insert line in file, or append beginning of file?

if you're programming in perl, it's worth taking hour or skim faq. it's full of useful information.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -