Phr0zen_Penguin

99 Bottles Of Beer

Sep 19th, 2014
606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.43 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. #!C:\Perl\bin\perl.exe -w
  3. ##
  4. ## NOTE:
  5. ## Your bang path on Windows may vary (depending on where you installed your Perl binaries).
  6. ##
  7. ####
  8. ## [99_bottles_pl.cgi]
  9. ##
  10. ## 99 Bottles Of Beer Lyrics.
  11. ##
  12. ## (c) Damion 'Phr0z3n.dev' Tapper, 2014.
  13. ####
  14.  
  15. use strict; # Strict drinking rules.
  16. use safe;   # Age assessment and such...
  17. use CGI qw(:all);
  18. use utf8;
  19.  
  20. print header(-type => "text/plain");
  21. # To print text/html output, change the new line character from '\n' to '<br />'
  22.  
  23. print '>>------------------> 99 Bottles Of Beer Lyrics <------------------<<' . "\n\n";
  24.  
  25.     for(my $bottles_of_beer = 99; $bottles_of_beer > 0; $bottles_of_beer--)
  26.     {
  27.         print $bottles_of_beer . ' bottle';
  28.  
  29.             ($bottles_of_beer != 1) ? print 's' : () ;
  30.  
  31.         print ' of beer on the wall, ' . $bottles_of_beer . ' bottle';
  32.  
  33.             ($bottles_of_beer != 1) ? print 's' : () ;
  34.  
  35.         print ' of beer.' . "\n";
  36.         print 'Take one down and pass it around, ';
  37.  
  38.             (($bottles_of_beer -1) != 0) ? (print $bottles_of_beer - 1) : print 'no more' ;
  39.  
  40.         print ' bottle';
  41.  
  42.             (($bottles_of_beer - 1) != 1) ? print 's' : () ;
  43.  
  44.         print ' of beer on the wall.' . "\n\n";
  45.     }
  46.  
  47. print 'No more bottles of beer on the wall, no more bottles of beer.' . "\n";
  48. print 'Go to the store and buy some more, 99 bottles of beer on the wall.' . "\n\n";
  49.  
  50. print '>>-------------------------------> + <-------------------------------<<';
  51.  
  52. exit;
Advertisement
Add Comment
Please, Sign In to add comment