in reply to Tie::File with absolute path of the file
In addition to what toolic has advised, you can test if your file is readable and writeable using -r and -w. In its default mode Tie::File tries to open the file in read/write mode so the file needs to be both readable and writeable.
If you only want to read the file you would use tie like this:
use Tie::File; use Fcntl 'O_RDONLY'; #... tie (my @content, 'Tie::File', $file, mode => O_RDONLY) or die "Could +not open $file: $!";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Tie::File with absolute path of the file
by colox (Sexton) on Dec 05, 2017 at 12:18 UTC |
In Section
Seekers of Perl Wisdom