Reputation: 40718
I tried to use the File::Slurp
module:
use v5.14;
use warnings;
use File::Slurp;
my $text = read_file( 'test.txt' ) ;
but when I run this I get error:
Can't locate File/Slurp.pm in @INC (@INC contains: /home/fcihh/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/fcihh/perl5/lib/perl5 /home/fcihh/perl5/lib/perl5/x86_64-linux-gnu-thread-multi /home/fcihh/perl5/lib/perl5 /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./p.perl line 5.
Running cpanm File::Slurp
gives:
File::Slurp is up to date. (9999.19)
Upvotes: 2
Views: 5723
Reputation: 385496
There are probably two perl
involved. Execute the following, using the same perl
as you're using to execute the script (specify the path if necessary):
perl -e'use CPAN; install "File::Slurp"'
You've since mentioned that your cpan
(unlike your cpanm
) is configured to use the same perl
as you're using to execute your script, so you can simply use
cpan File::Slurp
Upvotes: 7