Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Remove letters from variables used in math operation?

by BillKSmith (Vicar)
on Dec 09, 2012 at 03:22 UTC ( #1007947=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007947]
help
Chatterbox?
LanX Gesundheit! :)
talexb wonders about dividing developers in those born before the Unix timestamp of zero .. and after. Spoiler: I'm before.
chacham remebers I am a mad scientist
[stevieb]: talexb I'm after by a few years, but we can still be friends because you live in my hometown ;)
[LanX]: White House
[LanX]: next inauguration ?

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (11)
As of 2017-08-18 13:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (303 votes). Check out past polls.

    Notices?