-
-
Save igal/3311013 to your computer and use it in GitHub Desktop.
ben goofs off with 99 bottles ... now with moar minimalism.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature qw{say}; | |
sub bottles() { sprintf qq{%s bottle%s of beer} | |
, $_ || 'No' | |
, $_==1 ? '' : 's'; | |
} | |
sub store() { $_=99; qq{Go to the store, buy some more...\n}; } | |
sub wall() { qq{ on the wall\n} } | |
sub take() { $_-- ? qq{Take one down, pass it around\n} : store } | |
do { print bottles, wall | |
, bottles, qq{\n} | |
, take | |
, bottles, qq{\n\n} | |
} for reverse 0..99; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment