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

This is actually much easier than you might expect - Essentially you are looking at merging two hashes with the key-values of %runset having precedence of those in %description. This can be done as follows:

delete $runset{$_} for ( grep { !/^[A-Z]+$/ } keys %runset ); %merged_hash = ( %description, %runset );

This code will delete the non-uppercase key-value pairs in the %runset and then merge the two hashes - Any values in %description with an identical key-name in %runset will be replaced with the values in the latter (based on left-to-right execution).

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

Replies are listed 'Best First'.
OT your .sig
by mAsterdam (Sexton) on Mar 24, 2002 at 14:26 UTC
    Hi Rob,

    Thanks for sharing your knowledge. Even in your .sig?

    I tried pasting your .sig:

    $ $ perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print' In string, @cowsnet now must be written as \@cowsnet at -e line 1, nea +r "rob@cowsnet" Execution of -e aborted due to compilation errors. $ perl -e 's&&rob\@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print' rob@cowsnet_au$

    Am I missing something?

    HTH, Danny

    Update:

    $ perl -v This is perl, v5.6.0 built for i586-linux Copyright 1987-2000, Larry Wall . . .
      *chuckle* ... It looks like its time for me to update my .sig - Thanks for the tip mAsterdam++

       

      Save Ferris? Forget that ... Save tilly! [1]