Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

selecting values from hash via list

by leocharre (Priest)
on Nov 06, 2009 at 21:01 UTC ( [id://805582]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %h = (
       name => 'dumdum',
    ...
       zone => 'a4',
       pocket => 'empty',
    );
    
  2. or download this
    printf "%-20s %5d %s\n", $h{name}, $h{age}, $h{zone};
    
  3. or download this
    my %a;
    my @a = qw/name age zone pocket/;
    @a{@a}=();
    # looks weird, eh? ;-)
    # now 'exists $a{name}' is true!
    
  4. or download this
    printf "%-20s %5d %s\n", @h{qw/name age zone/};
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-16 22:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found