Next | Program Repair Shop | 53 |
104 next if $File !~ /\d/; 105 if (int(substr($File,0,5)) >= $Highest) { 106 $Highest = int(substr($File,0,5)); 107 }
This is worrisome
The code wants $File to begin with 5 digits
But the test on line 104 is not testing for that
Say what you mean
next if $File !~ /^\d{5}/;
Note that this renders the preceding /^\./ test unnecessary
(Also, the int is Just Plain Wrong)
(Apparently the programmer thinks it is for converting a string to an integer)
my $n = substr($File, 0, 5); if ($n > $Highest) { $Highest = $n; }
I also changed >= to >
Next | Copyright © 2002 M. J. Dominus |