"McGlinchy, Alistair" <[EMAIL PROTECTED]> writes: [snip] > 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. > > For those who like sand-traps, I suggest you shouldn't count > multiple messages that give the same warning for different quoted > strings. For example perl -we "a,b" gives four warnings (1.3/byte) > but only scores two distinct ones (0.66/byte). Nor can you count the > same warning on multiple lines of input. The following will > hopefully give a true distinct warnings score. > perl -we 'yourcode' 2>&1 | perl -ne 's/\042.*\042//;s/at > -e.*$//;$x{$_}++;END{print 0+keys%x}' [cut]
Well, why not? If I read your rules right, I have here a four in four -- 1.00 distinct warnings per byte of code -- coming up after spoiler space: [EMAIL PROTECTED]:~$ perl -ce 'c.$c' -e syntax OK [EMAIL PROTECTED]:~$ perl -e 'c.$c' [EMAIL PROTECTED]:~$ perl -we 'c.$c' 2>&1 | perl -pe '{local $_=$_; s/\042.*\042//;s/at-e.*$//;$x{$_}++}END{print 0+keys%x, $/}' Unquoted string "c" may clash with future reserved word at -e line 1. Useless use of concatenation (.) or string in void context at -e line 1. Name "main::c" used only once: possible typo at -e line 1. Use of uninitialized value in concatenation (.) or string at -e line 1. 4 [EMAIL PROTECTED]:~$ Eirik -- "Its failings notwithstanding, there is much to be said in favor of journalism in that by giving us the opinion of the uneducated, it keeps us in touch with the ignorance of the community." - Oscar Wilde