Challenge 1: Write Then Read — Possible Solution ==================================================================== use strict; use warnings; use feature 'say'; open(my $out, '>', 'output.txt') or die "Can't open: $!"; print $out "First line\n"; print $out "Second line\n"; print $out "Third line\n"; close($out); open(my $in, '<', 'output.txt') or die "Can't open: $!"; while (my $line = <$in>) { chomp($line); say $line; } close($in); Output: First line Second line Third line WHY THIS WORKS AS AN ANSWER ------------------------------ open(my $out, '>', 'output.txt') or die "..."; reuses the chapter's own 3-argument open with '>' mode and the required or die error check, exactly as the chapter's own writing example shows. print $out "First line\n"; (and the two lines after it) reuse the chapter's own print $fh "text" syntax precisely — no comma between $out and the string, per this chapter's own warn-box explaining that adding one would break the write entirely. Each string includes its own \n, since print never adds one automatically (Course 1, Chapter 1). close($out); is called before reopening the same file for reading — necessary because the write needs to be fully flushed to disk before a separate read of the same file can reliably see it. The second open/while/close block reuses the chapter's own while (my $line = <$fh>) idiom and chomp call exactly, this time with '<' mode — reading back the three lines just written, stripping each one's trailing newline before printing it with say, confirming the write-then-read round trip produced the expected three lines.