in reply to Money Regex


Since you don't really need to know what the exact sides are, why not let perl do most of this for you?
use strict; use Carp; my ($l, $r, @err) = split /\./, $test; carp "oops, more than 2 \.'s.\n" if @err; if ($l) { if ($r) { #handle case of rational dollars } else { #handle case of integer dollars } } else { carp "oops, we don't even have a dollar!\n"; }
This seems like it'll cover more cases than you currently have (never trust your user) and it seems a bit easier as well...

HTH,
jynx


ps if another monk can spot errors please do so, it's early and i haven't had my coffee yet...