When I load File::Find with require like this, how could I modify this script to not get the warning?
#!/usr/bin/env perl
use warnings;
use strict;
use 5.10.1;
require File::Find;
File::Find->import('find');
find( {
wanted => sub {
my $file = $File::Find::name;
#say $file;
},
no_chdir => 1,
},
shift );
Output:
#Name "File::Find::name" used only once: possible typo at ./perl9.pl line 11.
For starters, don’t load the file like that. 🙂
If you do, just add:
The clean way of doing it is to change
$File::Find::nameto