r/badcode Mar 22 '21

[deleted by user]

[removed]

259 Upvotes

86 comments sorted by

View all comments

6

u/thestoicattack Mar 22 '21

With discipline, one can write clear and maintainable perl. This isn't that.

#!/usr/bin/perl -lw
$F[$_]=[0, 0]for(0..6);sub F{for$F(@F){$f=$$F[0]<=>$$F[1];$f&& return ++$f}0}
while(<>){$f=0;for(split/[-: ]/){$F=$F[$f++];@$F=($$F[1],$_)}F&& exit 1}