Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by Athanasius (Archbishop)
on Feb 21, 2013 at 15:38 UTC ( [id://1019965]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #! perl
    use strict;
    ...
    my %h1 = (catastrophe => 1, cataclysm => 2, dogma => 3);
    my %h2 = map { $_ => $h1{$_} } grep { /^cat/ } keys %h1;
    dd %h2;
    
  2. or download this
     1:33 >perl 542_SoPW.pl
    ("catastrophe", 1, "cataclysm", 2)
    
     1:37 >
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 04:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found