in reply to Re: How not to write subroutines
in thread How not to write subroutines

I kind of liked the idea of putting in the mood of the programmer in comments.
# code to mimic uniq(1)
# mode: divine my @result = do { my %counter; grep ++$counter{$_} == 2, @input; };
# mode: tired for (@input) { $multiples{$_}++; } for keys( %multiples ) { print "$_\n" if (--$multiples{$_}); }
(And yes, both example stolen from Get All Duplicated Elements in an Array (Once, without shifting), and I mean absolutly nothing with the different modes.)
And when refactoring this code, a mode that suggest that the programmer was tired, drunk or thought him-/herself being merlyn is prime candidates for a rewrite.

Replies are listed 'Best First'.
Re^3: How not to write subroutines
by gustavderdrache (Acolyte) on Jan 15, 2006 at 15:38 UTC

    That's actually a good idea. I think I might just start doing that.

    "If you go on with this nuclear arms race, all you are going to do is make the rubble bounce" -- Winston Churchill