I'm learning perl and writing a script to output all contents in the directory tree of the script to a file. The problem is in the text file the entire output is on one line even though I'm including "\n". I have the save code printing to the console and I get the desired results there, which is one entry per line.

```
#!/usr/bin/perl -w

use Cwd;
use File::Find;
use strict;

my $file = "temp.txt";
my $dir  = getcwd;

unless ( open FILE, '>>' . $file ) {
    die "\nUnable to create $file\n";
}

find( \&print_type, $dir );

sub print_type {
    if (-f) {
        print FILE "File: " . "$_\n";
        print "File: " . "$_\n";
    }
    if (-d) {
        print FILE "Directory: " . $_ . "\n";
        print "Directory: " . $_ . "\n";
    }
}
close FILE;

```

I also tried putting a \n before the "Directory : " and that didn't work either.