What do you think of this?
use Modern::Perl q/2015/;
use Number::Range;
use Data::Dump qw/dump/;
# First we make the range objects
my $folded = Number::Range->new("655575645..827544086");
my $selfmail = Number::Range->new("827549192..827572977");
my ( @folded, @selfmail, @nomatch );
# Then we run our data through these ranges
while (<DATA>) {
chomp;
my $int = substr( $_, 11, 9 );
do { push @folded, $_; next } if $folded->inrange($int);
do { push @selfmail, $_; next } if $selfmail->inrange($int);
push @nomatch, $_;
}
say "Folded IMB Count: ", scalar(@folded);
say "No Matched IMB Count: ", scalar(@nomatch);
say "Selfmail IMB Count: ", scalar(@selfmail);
__DATA__
0026110795165557564528452972062
0026110795165557648628452974959
0026110795182749420290503162401
0026110795182749566690703875348
0026110795182750564290503365856
0026110795182751155490713282618
0026110795182751819190503415474
0026110795182752054790503331977
0026110795182752888194578410931
0026110795182753115893308242647
0026110795182753522398248322033
0026110795182753601890723246006
0026110795182754156995403760702
0026110795182754174597213102232
0026110795182754408698248770395
0026110795182754919290713221614
0026110795182755128698248922635
0026110795182755566790713334451
0026110795182755669490713213633
0026110795182755806390507009696
0026110795182756204890713212248
0026110795182756217690713273839
0026110795182756259998248961157
0026110795182756309595403769515
0026110795182756708894578164887
0026110795182756829090713282238
0026110795182757082791367220156
0026110795182757130090713274108
0026110795182757297798248934527
0026110795182757370277063564556
Output Folded IMB Count: 15
No Matched IMB Count: 1
Selfmail IMB Count: 14
The actual results are to be found in the arrays @folded, @selfmail and @nomatch. If you want to send the results to a file, just print these arrays to a file.
CountZero A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James My blog: Imperial Deltronics
|