Re: uninitialized value in a sort block



On Jun 29, 6:38 am, "alexxx.ma...@xxxxxxxxx" <alexxx.ma...@xxxxxxxxx>
wrote:
Hi Perlers,

I have a strange behavior happening sometimes to my filesystem
crawler:
inside tha wanted subroutine, I check the mod.times of the files:

@a=glob "$File::Find::name/*";
@a=sort {-M $a <=> -M $b} @a;

sometimes(rarely) what I get is:
Use of uninitialized value in numeric comparison (<=>) at
/usr/src/ chktimes line 33.

unfortunately I don't know why it's happening (file times seem
ok to me),
neither how to track the error, since the warning is printed on the
console, not synched with the print()'s I wrote here and there.

I don't know why -M would be returning undef offhand (maybe you lack
permissions to one of the files?) But it shouldn't be that hard to
debug...

my @a=glob "$File::Find::name/*";
my @mtimes = map { [$_, -M $_] } @a;
for (@mtimes) {
print "File: '$_->[0]'. Mtime: $_->[1]\n";
}

See which files are giving you the problem, and then see if there's
anything "special" about that file on the disk.

Paul Lalli

.



Relevant Pages

  • uninitialized value in a sort block
    ... I have a strange behavior happening sometimes to my filesystem ... inside tha wanted subroutine, I check the mod.times of the files: ...
    (comp.lang.perl.misc)
  • Re: uninitialized value in a sort block
    ... I have a strange behavior happening sometimes to my filesystem ... inside tha wanted subroutine, I check the mod.times of the files: ... unfortunately I don't know why it's happening (file times seem ...
    (comp.lang.perl.misc)
  • Re: uninitialized value in a sort block
    ... I have a strange behavior happening sometimes to my filesystem ... inside tha wanted subroutine, I check the mod.times of the files: ... That should reveal the file that causes the warning. ...
    (comp.lang.perl.misc)