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 wandering the Monastery: (7)
As of 2014-12-28 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls