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"; }