A previous reply gives some methods for deleting keys are that aren't upper case, but there's one other thing that you should be aware of: hash keys are not stored (or returned by keys) in any particular order. So your code might print "I am a monk in training", or it might print "a monk in training am I", which sounds like something Yoda might utter.

Actually, as long as your print statement includes $key, your output is also not going to be formatted quite as you expect: "TEST IABC amBAR a monk in training" is one possibility. (Note the lack of spaces, too.) What you really want inside the loop is probably something like this:
print $runset{$key}, " "

Or, even more Perlish, get rid of the enclosing loop and just use this:
print join " ", values %runset;

This latter version also eliminates the trailing space, because join only inserts delimiters between list elements.


In reply to Re: Parsing a hash table for only variables that are uppercase. by seattlejohn
in thread Parsing a hash table for only variables that are uppercase. by Rhodium

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.