Steve Grazzini wrote:
On Mon, Oct 27, 2003 at 09:52:20PM -0600, Andrew Gaffney wrote:

I have an array of keywords that I need to generate. I have 2 separate input files. The first one contains the defaults. The second input file contains additions and overrides. For example, first input:

key1 key2 key3 key4 key5 key6 key7

second input:

-key3 -key5 key8 key9

end result:

key1 key2 key4 key6 key7 key8 key9

What is the easiest/fastest way to do this?


my @array = do { local @ARGV = qw(default.txt override.txt);
local $^I;


        my %params;
        while (<>) {
            foreach (split) {
                if (s/^-//) {
                    delete $params{$_};
                }
                else {
                    $params{$_}++
                }
            }
        }
        sort keys %params;
    };


Thank you.


--
Andrew Gaffney


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to