On 10/03/2013 12:23 AM, Harry Putnam wrote:
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];
you don't have the dir there so the file isn't found by stat.
you need "$f/$File::Find::name"
if ($eperm eq $exe){
that is wrong as perms are usually integers. use ==. also when you
assign $exe use octal format as it is much easier to deal with than
decimal for perms.
print $File::Find::name . "\n";
that only prints the filename as you see. stat needs the dir too.
uri
--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/