The 30-digit test you run is implied if you simply check the results of your capturing regex:
#!/usr/bin/perl
###########################################
use warnings;
use strict;
my $test = "000000000000022102840002210284";
if ( $test =~ /^(\d{10})(\d{10})(\d{10})$/ ){
print "1 = $1\n2 = $2\n3 = $3\n";
}
else {
print STDERR "Bad 30-digit number!$/";
}
Of course, there are tons of ways to handle this problem. =)
mhoward - at - hattmoward.org
|