c:\@Work\Perl\monks>perl -wMstrict -le "use List::Util qw(sum); use Regexp::Common; ;; my $user_total = total(); ;; print qq{The total of user-input integers is $user_total}; ;; sub total { ;; my $n = $RE{num}{real}; ;; die qq{user input <<@_>> unuseable} unless @_ == map m{ \A \s* $n (?: \s+ $n)* \s* \z }xms, @_; ;; return sum map m{ $n }xmsg, @_; } " 123 4. .5 0.0 .0 0. -.7 -11 ^Z The total of user-input integers is 115.8