Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Remove letters from variables used in math operation?

by BillKSmith (Priest)
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,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007947]
[Discipulus]: LA you know who is paco?
[Lady_Aleena]: Disc, nope.
[Discipulus]: ahi ahi ahi!!
[Lady_Aleena]: paco is a little over 2 years before my time.
[Discipulus]: you can try tachyon's iterative approach Re: Win32 Recursive Directory Listing
[Lady_Aleena]: I'm on Linux/
[beech]: isn't 2 year about standard recovery time for that kind of surgery?
[Discipulus]: if you hate FIle::Find
[Lady_Aleena]: I don't hate it, it just drives me crazy.
[Discipulus]: LA the solution is portable to whatever

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2017-04-23 20:39 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.