Skip to content

Instantly share code, notes, and snippets.

@notbenh
Created August 10, 2012 03:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save notbenh/3310781 to your computer and use it in GitHub Desktop.
Save notbenh/3310781 to your computer and use it in GitHub Desktop.
ben goofs off with 99 bottles
#!/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 $_-1, 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