Skip to content

Instantly share code, notes, and snippets.

@igal
Forked from notbenh/99.pl
Created Aug 10, 2012
Embed
What would you like to do?
ben goofs off with 99 bottles ... now with moar minimalism.
#!/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