I suspect that there are a lack of replies to your post for
several reasons:
Although you use -w you aren't using strict.
You're slinging all sorts of backticked xnix commands
around without testing for errors.
What happens if the two files have more than one
different line in them? What will happen if two files have
no differences? These are some questions that are not
addressed either by code, comments or your description of
the problem.
Your're using xnix commands on file vars read from
STDIN without testing to see they exist or not. Hopefully,
you will be the only person running the program. An
unscrupulous user could type nasty xnix commands instead of
file names. You might want to consider taint checking.
These are just a few problems. Sharper eyes than mine will
certainly find more. You should probably consider these
suggestions, rework your code, add more details defining
your problem and post the revised version as an update. The
more you do in preparing your post, the more likely that
others will respond to it.
"Make everything as simple as possible, but not simpler." -- Albert Einstein