use strict; use warnings; use Test::More qw(no_plan); my $regex = qr{ ... stuff ... }x; # Tests like( '100', $regex, 'Valid numeric' ); like( '_100', $regex, 'Valid numeric with leading underscore' ); # etc. unlike( '', $regex, 'Invalid empty string' ); # etc.