in reply to reg exp

OK, quick hack of your code gives me this:
#!/usr/bin/perl use strict; use warnings; my @test = ( 123, 12345, 12345678, "abc-abc", "abc-abcd" ); foreach my $match ( @test ) { if ( $match =~ m/\d{5,8}|\w{3}-\w{4}/ ) { print "$match match\n"; } else { print "$match doesn't match\n"; } }
Which seems to work.
(Note that I have used \w instead of \D. See the manpage for what the difference is).
But like the man said in the previous post. perldoc perlre.

--
It's not pessimism if there is a worse option, it's not paranoia when they are and it's not cynicism when you're right.