You are right. I come from a C++ back ground, so I don't use ne or eq much, so I just figured that if you get the warning for == the you would get it in the reverse direction with eq. But since perl will happily convert a number to a string, the problem doesn't exist. For added fun I benchmarked the difference between the regex and ne: Y:\>perl -MBenchmark -we "print timethese( 10_000_000, {Regex, '$_=0;
+print q[]
if $_ !~ /^$/', NotEq, '$_=0; print q[] if $_ ne qq[]' } )"
Benchmark: timing 10000000 iterations of NotEq, Regex...
NotEq: 27 wallclock secs (26.41 usr + 0.00 sys = 26.41 CPU) @ 37
+8658.79/s
(n=10000000)
Regex: 37 wallclock secs (36.69 usr + 0.00 sys = 36.69 CPU) @ 27
+2531.55/s
(n=10000000)
HASH(0x8c134b0)
|