[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Wanted - Have = Need



On Fri, 13 Oct 2000 at 07:58:50 +0000, John Carter wrote:
> This looks like a nice game of golf...

> I have a file full of things I have and a file full of things I want, and
> I want a list of things I still need to build (that which is in the wanted
> list but not the have list.)
> 
> open( HAVE, "have");
> %Have = map {$_=>1} <HAVE>;

Thanks - for some reason I've never thought of putting <..> as parm to a map.
I've often written `cat have` in one-liners.

> close HAVE;
> open( WANTED, "wanted");
> print grep { !exists( $Have{$_})} <WANTED>;
 print grep { !$Have{$_} } <WANTED>;

> close WANTED;

What's all this "close" business? Let the OS close it!

Hmm:
	join -v2 =(sort have) =(sort wanted)

(This is zsh notation. Other shells aren't as fluent..)

Ian

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe