$a = $b if $a != $b; # or if you want to stick to the order if( ) then; $a != $b and $a = $b;