En r�ponse � Brad Greenlee <[EMAIL PROTECTED]>:
> What's really stumping me is that there has to be a shorter solution
for
> wc.pl (mine is 23), but I haven't been able to get past the need for
> printf (at least, not for a shorter solution). Has anyone managed to do
> it
without it?
My wc.pl is 21, but uses printf. I tried many things to get rid of printf,
but all of them ended up being longer...
Here they are (the first ' ' marks the end of the command-line switches):
-n END{print$a,$/}BEGIN{$a='00'x5}++$a # 38
-n BEGIN{$a=$-x10}$a++;END{print$a,$/} # 38
-n INIT{$a=$-x10}$a++;END{print$a,$/} # 37
-lp0 $_=y/\n//;$_=$-x(- y///c%10).$_ # 36
-lp0 $_=substr$-x9 .y/\n//,-10 # 30
These are the longuest I did. All my shorter ones use printf.
At first, I used $^W, which also equals 0, but if you want it to take only
2 chars, it's not very printable/visible.
In fact, here are all the special vars that equal 0 when perl starts:
$^C, $^D, $^H, $^P, $^S, $^W, $%, $-, $?
--
Philippe "BooK" Bruhat
Eliminate a problem before it eliminates you!
(Moral from Groo The Wanderer #65 (Epic))