Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
This looks embarrassingly similar to my first Perl scripts, except that I never called subroutines with a leading & because I had the luck to learn Perl 5 from the start ;-).
It's a typical case of not knowing about autovivification: instead of assigning 0 to every possible hash key, and later sort out those which remained 0, you can simply leave out both steps altogether. It is also typical in confusing ASCII with an 8-bit encoding. A non-golfed version:
It doesn't prompt for a filename, instead it either expects a file name on the command line, or reads from STDIN - in good old unix tradition. In reply to Re: Golf: Improve this guy's fail . . . please!
by moritz
|
|