Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by graq (Curate)
on Jan 23, 2007 at 08:25 UTC ( [id://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 )=-

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found