Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Is there a simple syntax to logically slice a hash?

by tobyink (Abbot)
on Feb 21, 2013 at 15:42 UTC ( #1019966=note: print w/replies, xml ) Need Help??


in reply to Is there a simple syntax to logically slice a hash?

Something like this?

use strict; use warnings; use Data::Dumper; my %orig = ( cat => 22, dog => 23, category => 66, catalyst => 77, cataclysm => 88, dogma => 89, dogstar => 92, ); my %cats_only = map { $_ => $orig{$_} } grep /^cat/, keys %orig; print Dumper \%cats_only;
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019966]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2016-12-09 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.