On Oct 24, Kingsbury, Michael said:

>compiling xyz
>"a: warning"
>"b: warning"
>compiling more stuff.
>"a: warning"
>
>I want to get one instance of each warning & output it to a file.  I can do
>that by backticking it through sort, and loading lines that start with a " &
>don't match the previous entry, and then writing that array to a file.
>This seems cumbersome. 

Right.  Use a hash.

  while (<OUTPUT>) {
    next unless /^"/;
    $error{$_} = 1;
  }

>Part 2.  Given the above, I want to compare an older list of warnings, and
>capture only new ones...    Without loading them into arrays & doing
>foreaches on the array to compare, I can't think of how to do this.  

Use another hash.  Let's call it %olderror.

  delete @error{ keys @olderror };

Now the only keys in %error are ones that didn't appear in %olderror.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


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

Reply via email to