$bar = "this\nthat\n"; open(FH, '<', \$bar); $this = ; # reads "this\n" $that = ; # reads "that\n" open(FH, '>', \$bar); print FH "this\n"; print FH "that\n";