Mega Code Archive

 
Categories / Perl / File
 

Open for writing first, then reading

#!/usr/bin/perl print "\n\n"; open(FH, "+>aFile") || die; print FH "This line is written to joker.\n"; seek(FH,0,0);         # Go to the beginning of the file while(<FH>) {     print;            # Reads from aFile; the line is in $_ }