na has asked for the wisdom of the Perl Monks concerning the following question:
where script './a' goes:$ perl ./a Useless use of numeric gt (>) in void context at /work/tmp/a line 4.
My guess is that the Perl optimizer considers "-M '/tmp/c'" as just a boolean expression by itself, not a part of scalar comparison.#!/usr/bin/perl use warnings; my $flag= ((-M '/tmp/a') > (-M '/tmp/b')); #no warnings my $flag2= $flag and ((-M '/tmp/c') > (-M '/tmp/d')); #warning at here
raise a waring message. How should I write in this case?if(-f $file1 and ((-M _) > (-M $file2))){ ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Warning with file test(-M)
by borisz (Canon) on May 01, 2005 at 08:04 UTC | |
|
Re: Warning with file test(-M)
by eibwen (Friar) on May 01, 2005 at 08:28 UTC |