http://www.perlmonks.org?node_id=11104340


in reply to Open a file

Let Perl tell you the reason why it failed:

my $filename = "C/Perl64/Perl Scripts/Names.txt"; open(my $fh,'<:encoding(UTF-8)', $filename) || die "Could not open file '$filename': $!";

Replies are listed 'Best First'.
Re^2: Open a file
by liljohn (Initiate) on Aug 12, 2019 at 21:29 UTC

    Thank you so much, Once I used your suggested code and saw the message "no such file" I realized I had omitted part of the file path.</pP

      Don't you love it when a plan comes together so easily? :)

      By the way, welcome to the Monastery, liljohn! I've just got a small suggestion here... you've done an excellent job of following this site's posting syntax, but it appears as though you've missed a couple of closing tags. The </p> closing tag in this post, and the </code> tag in your Original Post (OP) don't have the > in place. Any chance you could go back and edit them in? If not, our Editors will get notified and will have to do that for you.

      Keep up the good work here. A newcomer responding back to a helpful post goes a long way.