In response to your solution, Japhy...I called on the help of a friend to try and help me decode it.
print $messages{$guess <=> $answer}, "\n"; that's mean there are processes, and the processes are :

1. firstly, a comparison between $guess and $answer. $answer isnt defined yet so
$answer = 0. Looking back at $guess = 0, $answer= 0, 0 <=> 0 (zero compare zero) will return 0.

2. $guess <=> $answer return 0 that's mean we we're returning '0' to $guess, then look at this $messages{$guess} alias $messages{0}.

3. what's the value of $messages{0} and we print it, "print $message{$guess} aka print $message{$guess} alias "just right"

So, is this grasping the concept behind $messages{$guess <=> $answer}? which is the part I am mostly trying to understand.

"Es gibt mehr zu Leben als Bücher, kennen Sie. Aber nicht viel mehr " -(Der Smiths)

In reply to Re^2: Having an expression as a hash key by sub_chick
in thread Having an expression as a hash key by sub_chick

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.