[Solved] String Comparison

Hi I am beginner in writing shell scripting please tell me how to compare a string in Unix shell.
i have two variables in a shell script,

var1="00101 00201 00301 303 401 405"
var2="101 201 301"

i want to compare var1 with var2 . for example if 101 from Var1 present in Var2 or not. similarly 201 of Var1 present in Var2. If the value of Var1 & Var2 is matching i want to exclude those values and store the remaining values in Var3.
My output should be

Var3="303 401 405"

Please help to solve this problem.

one (slightly ugly) method

export var1
export var2
var3=$(perl -e '@s=split/ /,$ENV{var2};$m=$ENV{var1};for (@s){$m=~s/\s?0*$_\s?/ /g;}print $m;' )

Hi Skrynesaver,
For the same problem If the values of Var1 & Var2 are similar for eg

var1 = "203343 2222222222"
 var2 = "203342 2222222222"

i want to allow upto one mismatch then how to get it done now in the above case it has a single mismatch so i should get that also in my output. i know there is something called agrep but there is any perlish way to do that

Hi, anurupa777.

% perldoc -q approx
Found in /usr/share/perl/5.10/pod/perlfaq6.pod
   How can I do approximate matching?
       See the module String::Approx available from CPAN.

Best wishes ... cheers, drl

Shell:

var3=
for i in $var1; do
  for j in $var2; do
    if [ $i -eq $j ]; then
      continue 2
    fi
  done
  var3="$var3$i "
done

Hi all,
Thanks for your reply