On Thu, Sep 02, 2004 at 03:50 +0300, Juho Snellman wrote: > On Wed, Sep 01, 2004 at 08:34:32PM +0100, McGlinchy, Alistair wrote: > > Puzzle: Write a one-liner longer than (say) 3 bytes that can improve > > on 0.77 distinct warnings per byte of code. The program should be -c > > valid, output nothing without -w and sound the alarm as much as > > possible with -w. > > 4 bytes, 5 warnings for 1.25 warnings / byte.
What about this one? ice:~>perl -we '$a%a' Unquoted string "a" may clash with future reserved word at -e line 1. Operator or semicolon missing before %a at -e line 1. Ambiguous use of % resolved as operator % at -e line 1. Useless use of modulus (%) in void context at -e line 1. Name "main::a" used only once: possible typo at -e line 1. Argument "a" isn't numeric in modulus (%) at -e line 1. Use of uninitialized value in modulus (%) at -e line 1. Illegal modulus zero at -e line 1. It depends on how you define "do nothing" for the non -w case. It does produce a non-zero exit code. ice:~>perl -e '$a%a' Operator or semicolon missing before %a at -e line 1. Ambiguous use of % resolved as operator % at -e line 1. Illegal modulus zero at -e line 1. CU, Sec -- perl -nle 'print "$_ is divisible by 7" if (unpack("B*",reverse pack("L",$_))=~ /^0*((1((0(01|1(001*0)*11)*(00|1(001*0)*10))|1(01*0(1(10)*11)*0)*01*0(1(10)* 11)*1(10)*0)*(1(01*0(1(10)*11)*0)*1|0(01|1(001*0)*11)*1(001*0)*01))0*)+$/x)'