in reply to No such file or directory
$file = "New Text Document.txt"; open (FILE, $file) or die "$!\n";
I would venture the wild guess that there is no file New Text Document.txt in the directory from where you run your Perl program.
Personally, I would use the following idiom, which produces a somewhat nicer error message:
$file = "New Text Document.txt"; open my $fh, $file or die "Couldn't open '$file': $!\n";
|
|---|