in reply to Increase script speed
Hello ctrevgo_learn_perl, and welcome to the Monastery!
As graff says, you need to supply more information. For example, what is the format of a typical line read from the file “test.txt”? There seems to be some confusion:
# Strip the mbox and id, assuming the file contains mbox:id my($mbox,$id)=split(',',$_);
Aside from the fact that there is no stripping happening here, the comment specifies that the initial two items will be separated by a colon, but the code assumes a comma. If the comment is correct but the data line happens to contain a comma somewhere, this will “work” without warnings but will produce spurious results.
I note also that the script has:
use File::Slurp qw(read_dir); ... use Data::Dumper;
but neither module appears to be actually used?
And an observation on style. The use constant declarations can be written more clearly, like this:
use constant { DRY => 1, # Dry run. 0 will execute FILE => 'test.txt', # Hardcoding the file path as + of now STATS_FILE => 'mbox_stats.txt', # Successful operation - stat +s file MBOX_UNKNOWN => 'mbox_unknown.txt', # Failed mailbox operations VOL => '/home/folder/', # TOP Level volume directory DEBUG => 1, };
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|