http://www.perlmonks.org?node_id=1007947


in reply to Remove letters from variables used in math operation?

The use of several modules can increase the flexability of your code without introducing the potential errors mentioned by other responders.
use strict; use warnings; use v5.10.1; use Readonly; use List::Util qw(sum); use Regexp::Common; Readonly::Scalar my $NUMBER => qr/$RE{num}{real}/; while (my $line = <DATA>){ chop($line); say sum( $line=~/($NUMBER)/g ); } __DATA__ 86f,934e,92,102i,14,19,222,
Bill