Here is another approach that will count the numbers of digits in a given string.
use strict;
use warnings;
my @count;
my $i = 0;
while ( my $string = (<DATA>) ) {
$string =~ s/(\D+)//g;
push @count, split( //, $string );
}
for (@count) {
++$i;
if ( $i >= 7 ) {
print "\n7 or more so send to stop_spam() routine\n";
exit;
}
}
__DATA__
Title: !! back!! 7073347120 FREE VaShiKaRaN SpeCiaLisT IN Allahabad
Post: 707334712070733471207073347120707334712070733471207073347120
|