Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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]
[JohnCub]: I hope $way isn't a hashref. ;)
[GotToBTru]: many times i've been told I made a real hash of thiings
[GotToBTru]: so .. perhaps it should b e
[thepkd]: Just wondering why $aohoaoh[0]->{'foo '}[0]->{'bar'} would be difficult to read and understand?
[thepkd]: I am a noob and find it easier
[thepkd]: I mean with the branching clearly defined

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2016-12-06 13:53 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (105 votes). Check out past polls.