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;

Or:

my $exe = 0100755;


my $eperm;

You don't really need this variable at file scope.


my $f = shift;

find( sub {
     return unless -f;

Your $exe value includes the file type so this test is redundant.


     $eperm = (stat($File::Find::name))[2];

That should be:

      $eperm = (stat)[2];

Or if you still want to include the -f test but don't want to stat the same file twice:

      $eperm = (stat _)[2];


     if ($eperm eq $exe){

You are comparing numerical values so that should be:

      if ($eperm == $exe){


       print $File::Find::name . "\n";
     }
    },
    $f
);




John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to