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

Re^5: Passing input through a hash then displaying results

by graq (Curate)
on Jan 23, 2007 at 08:25 UTC ( #596049=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Passing input through a hash then displaying results
in thread Passing input through a hash then displaying results

How do I represent the values and keys in a loop or conditional statement?

You gets the keys and values of a hash using keys and values.
There is various documentation throughout the internet: keys and values.

I'm not sure if map counts as a loop, but if it does, then this has hash values in a loop and a conditional (or two):

sub get_grade { my $score = shift; my $grade = 'Ungraded'; $score = 0 unless $score =~ /^\d+$/; map { $grade = $grade_scores{$_} if $score > $_ } sort keys %grade_s +cores; $grade; }

-=( Graq )=-


Comment on Re^5: Passing input through a hash then displaying results
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2014-10-25 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (142 votes), past polls