Why is this script showing uninitialized variable warnings?
----- ------ ---=--- ------ -----
#!/usr/local/bin/perl
use strict;
use warnings;
use File::Find;
my $exe = 33261;
my $eperm;
my $f = shift;
find( sub {
return unless -f;
$eperm = (stat($File::Find::name))[2];
if ($eperm eq $exe){
print $File::Find::name . "\n";
}
},
$f
);
----- ------ ---=--- ------ -----
For every file it finds it also shows an uninitialized var warning.
In a test directory of some 16 type -f files.
Only 3 match the mode I'm after.
The script outputs those 3 but then also 3 uninitialized var
warnings.
,----
| script.pl .
|
| file1
| file2
| file3
| Use of uninitialized value $eperm in string eq at ./fiex line 13.
| Use of uninitialized value $eperm in string eq at ./fiex line 13.
| Use of uninitialized value $eperm in string eq at ./fiex line 13.
`----
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/