Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Hash Math

by tobyink (Abbot)
on Mar 11, 2013 at 14:41 UTC ( #1022805=note: print w/ replies, xml ) Need Help??


in reply to Hash Math

Something like this?

use 5.010; use strict; use warnings; use List::Util 'sum'; my %messages; $messages{one} = { from => "Alice", to => "Bob", size => 1000, }; $messages{two} = { from => "Bob", to => "Carol", size => 200, }; $messages{three} = { from => "Carol", to => "Dave", size => 30, }; $messages{four} = { from => "Dave", to => "Eve", size => 4, }; say sum map $_->{size}, values %messages;
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: Hash Math
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022805]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2015-08-28 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (335 votes), past polls