I don't see a reason to invoke the regex compiler for every match.
if ( m/^(\d+)(?(?{ $^N < $min || $^N > $max })(?!))$/ ){ print "$_ is between $min and $max\n"; }
$^N was introduced in 5.8. Using $1 would provide backwards compatibility if required.
In reply to Re^2: Match range of number
by ikegami
in thread Match range of number
by johntio
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |