# Strip the mbox and id, assuming the file contains mbox:id my($mbox,$id)=split(',',$_); #### use File::Slurp qw(read_dir); ... use Data::Dumper; #### 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 - stats file MBOX_UNKNOWN => 'mbox_unknown.txt', # Failed mailbox operations VOL => '/home/folder/', # TOP Level volume directory DEBUG => 1, };