Uri Guttman <u...@stemsystems.com> writes: [...]
>> 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" > [...] > >> print $File::Find::name . "\n"; > > that only prints the filename as you see. stat needs the dir too. I'm probably misreading the documentation but to me perldoc File::Find seems to be saying that $File::Find::name is supposed to contain the directory and file name >From perldoc File::Find [...] ,---- | For example, when examining the file /some/path/foo.ext you will have: | | $File::Find::dir = /some/path/ | $_ = foo.ext | $File::Find::name = /some/path/foo.ext `---- [...] And in fact trying your suggestion in my script, it looks like it would try to make stat do something a bit unusual. Like try to stat an unrecognizable file name. If I aim the altered script at a directory named td with files named one, two, three in it, you can see the results (PS - I've changed $f for $d which makes more sense) ------- --------- ---=--- --------- -------- #!/usr/local/bin/perl use strict; use warnings; use File::Find; my $d = shift; find( sub { print "\$eperm = (stat($d/$File::Find::name))[2]\n"; }, $d ); ------- --------- ---=--- --------- -------- ,---- | 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 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/