colox has asked for the wisdom of the Perl Monks concerning the following question:
been frying my brain what was wrong with my code as it always fail when it parse the content of the file using tie::file. so i did subset of my code as below & as you can see, simple file test has no error but when i parse the file using tie::file, it throws an issue. please have a look & let me know if i missed anything critical here.
use strict; use warnings; use Tie::File; my $dir = "//folderA/folderB/folderC"; my $file = "//folderA/folderB/folderC/folderD/file.txt"; if (-d -e -r $dir){ print "Folder exists and readable.\n";} if (-f -e $file){ print "File exists and accessible.\n";} tie my @content, 'Tie::File', $file or die "Cannot open $file for read +ing."; Folder exists and accessible. File exists and accessible. Cannot open //folderA/folderB/folderC/folderD/file.txt for reading. at + te st.pl line 14.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Tie::File with absolute path of the file
by tangent (Parson) on Dec 05, 2017 at 01:22 UTC | |
by colox (Sexton) on Dec 05, 2017 at 12:18 UTC | |
Re: Tie::File with absolute path of the file
by toolic (Bishop) on Dec 05, 2017 at 01:11 UTC | |
by AnomalousMonk (Archbishop) on Dec 05, 2017 at 02:42 UTC | |
Re: Tie::File with absolute path of the file
by haukex (Archbishop) on Dec 05, 2017 at 06:13 UTC |
Back to
Seekers of Perl Wisdom