in reply to Warning with file test(-M)

The problem is that and has a lower priority as =. This means that you wrote
( my $flag2= $flag ) and ((-M '/tmp/c') > (-M '/tmp/d'));
instead of
my $flag2= $flag && ((-M '/tmp/c') > (-M '/tmp/d'));
Boris