in reply to Parsing a hash table for only variables that are uppercase.

Well since you say delete you could use something like
for (keys %runset) { unless($_ eq uc($_)) { delete $runset{$_}; } }
before your printing loop.

However you have another problem: a hash is un-ordered, so you won't get the sentence you expect unless you are very lucky - you need some way to specify the order in which the values of the uppercase keys are printed. The example you provide doesn't work for a simple sort of the uppercase keys so you'll have to think of something else.

--
I'd like to be able to assign to an luser

Replies are listed 'Best First'.
Re: Re: Parsing a hash table for only variables that are uppercase.
by Dice (Beadle) on Mar 24, 2002 at 17:16 UTC
    While it goes beyond the scope of the problem, a hash can be made to be ordered by using the CPAN module Tie::IxHash.

    Link to Tie::IxHash documentation
    Link to Tie::IxHash tarball

    Usage:

    #!/usr/bin/perl -w
    
    use strict;
    use Tie::IxHash;
    
    tie my %ordered_hash, Tie::IxHash;
    
    %ordered_hash = (a => 1, b => 2, c => 3);
    
    foreach my $key ( keys %ordered_hash ) {
        print "$key\t$ordered_hash{$key}\n";
    }
    
    # prints:
    # a     1
    # b     2
    # c     3
    
    exit 0;
    
    

    Cheers,
    Richard