in reply to same program different output

You've just found out that =~ is not a symmetrical relation, while == is. Other asymmetrical relations are <, >, <=, >=. Other symmetrical relations are != and eq. If you want to learn more on (symmetric) relations, see Symmetric relation.

Would it surprise you if a program that used $a < $b had output different from an otherwise identical program that used $b < $a?