Uri Guttman <u...@stemsystems.com> writes:

[...]

>> ,----
>> | script.pl ./td
>> | $eperm = (stat(./td/./td))[2]
>> | $eperm = (stat(./td/./td/three))[2]
>> | $eperm = (stat(./td/./td/one))[2]
>> | $eperm = (stat(./td/./td/two))[2]
>> `----
>>
>> That will be a non-working comparision
>
> in your original code and output you printed $File::Find::name and it
> only showed the file part and not the dir. maybe you had an empty dir
> there but that is what i was basing my comment about. stat would fail
> unless it had the dir in the path. that would be the cause of your
> undef warning.

I don't think that is really all of it either.

If you use Johns' formulation:

 my $var = (stat)[2];

That is not including the directory either... but it works.

In fact that truly is using just the end file name $_.

So doesn't it mean that inside find() the program is changing dir
right along with the search for executable files? That is, every time
the search digs a directory deeper, `stat' is called inside that
level.

Isn't that the only way that '$_' would consistently work in stat?

The only  way directory + file would work consistently would be
to only `stat' absolute file names.


-- 
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