perl, was Re: [plug] Merging 2 files, CVS-style

Mike Holland myk at golden.wattle.id.au
Thu Apr 13 15:36:55 WST 2000


A pity you dont have the common ancestor.
Whats wrong with Perl BTW?
Its perfect for that kind of thing - no need to run 'grep' or 'cut'
externally.
It can be a lot 'neater' too, .e.g.
	 sub gtr {return $_[0] > $_[1] ? $_[0] : $_[1]; }

and system("diff -u$size $f1 $f2 | grep '^ ' | cut -c2- > $merge");
becomes something like:

	$merge = map '/^ (.*)$/' `diff -u$size $f1 $f2`;

I like perl. Such a great hack.

Mike Holland  <mike at golden.wattle.id.au>
                          --==--
"A dirty mind is a joy forever."
-- Randy Kunkee






More information about the plug mailing list