in reply to Warning with file test(-M)

You can find operator precendence in perlop.

Additionally, don't forget to use strict; You may also be interested in use diagnostics; which yielded a considerable amount of diagnostic information for your code:

Useless use of numeric gt (>) in void context at ./tmp line 8 (#1)
    (W void) You did something without a side effect in a context that does
    nothing with the return value, such as a statement that doesn't return a
    value from a block, or the left side of a scalar comma operator.  Very
    often this points not to stupidity on your part, but a failure of Perl
    to parse your program the way you thought it would.  For example, you'd
    get this if you mixed up your C precedence with Python precedence and
    said
$one, $two = 1, 2; when you meant to say ($one, $two) = (1, 2); Another common error is to use ordinary parentheses to construct a list reference when you should be using square or curly brackets, for example, if you say $array = (1,2); when you should have said $array = 1,2; The square brackets explicitly turn a list value into a scalar value, while parentheses do not. So when a parenthesized list is evaluated in a scalar context, the comma is treated like C's comma operator, which throws away the left argument, which is not what you want. See perlref for more on this. This warning will not be issued for numerical constants equal to 0 or 1 since they are often used in statements like 1 while sub_with_side_effects() ; String constants that would normally evaluate to 0 or 1 are warned about.
Use of uninitialized value in numeric gt (>) at ./tmp line 7 (#2) (W uninitialized) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign a defined value to your variables.
To help you figure out what was undefined, perl tells you what operation you used the undefined value in. Note, however, that perl optimizes your program and the operation displayed in the warning may not necessarily appear literally in your program. For example, "that $foo" is usually optimized into "that " . $foo, and the warning will refer to the concatenation (.) operator, even though there is no . in your program.

Line numbers pertain to the following code (OP's code with addition of use strict; and use diagnostics;):

#!/usr/bin/perl use strict; use warnings; use diagnostics; my $flag= ((-M '/tmp/a') > (-M '/tmp/b')); #no warnings my $flag2= $flag and ((-M '/tmp/c') > (-M '/tmp/d')); #warning at here