"John W. Krahn" <jwkr...@shaw.ca> writes: First, thanks for the input.
[...] >> my $exe = 33261; > > Or: > > my $exe = 0100755; Where does that come from? And it appears some kind of conversion must take place. If you print $exe right after assigning it 0100755, it still shows 33261. >> my $eperm; > > You don't really need this variable at file scope. Ahh, and moving the `my' declaration inside the scope of the subroutine seems to work ok, but not sure I really understand why its important. At least this case its not the reason the `uninitialized' warning shows up. So, it appears KennethW had it right when he said: KennethW wrote: > Looks to me like $eperm is a variable inside the scope of the sub. > That is used without using "my". However, to KennethW, that really isn't the source of the `uninitiated' warnings. Aside: I've often wondered what harm is done by declaring things globally rather than inside a tighter scope. I mean when its a small program like this. I started out thinking it was a good idea to keep all the variables in one place (on simple scripts) just for editing purposes. I'm sure I read why that is bad idea at some time or other but may have forgotten. So, why is that a bad idea? Anyway John nails the real source of the problem below when he says to use `(stat)[2]' which operates on $_ instead of trying to operate on $File::Find::name, as I was. I guess the search has changed dir into where ever the files are so trying to operate on $File::Find::name would be trying to find the file name outside the current directory instead of inside it. (Unless I happened to pass in a directory by its absolute name like: `script.pl /path/to/dir') >> return unless -f; > > Your $exe value includes the file type so this test is redundant. Ok, I get that now you point it out. I first thought that using: `return unless -f', would keep out the directories, and hence work stat a little less, but I see now that -f is really just a disguised stat. > >> $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]; I think I see what is happening there now.. thanks > >> if ($eperm eq $exe){ > > You are comparing numerical values so that should be: > > if ($eperm == $exe){ > On this, I'm still a bit confused. Far as I can tell, I'm actually making a string comparison. I mean, I'm not doing math, I'm just comparing one string to another that happen to be numbers. So I guess what folks are telling me here is that if the variable is an integer it needs `==' rather than `eq' no matter how its being compared. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/