1
<?xml version="1.0" encoding="UTF-8"?>
3
<header>Perl code</header>
4
<para>Example Perl code</para>
5
<code xml:whitespace="preserve" language="perl">
11
#######################################
13
# 99 bottles of beer on the wall
14
# Written in object oriented Perl
16
#######################################
17
my $beer = Bottles->new();
18
$beer->Take_One_Down() while $beer->Remaining();
31
my $s = $$self == 1 ? '' : 's';
33
print "$$self bottle$s of beer on the wall,\n";
34
print "$$self bottle$s of beer.\n";
35
print "Take one down, pass it around.\n";
39
$s = $$self == 1 ? '' : 's';
41
print "$$self bottle$s of beer on the wall.\n\n";
51
<para>Origin: http://www.99-bottles-of-beer.net/language-perl-648.html</para>
52
<para>Alternative</para>
53
<code xml:whitespace="preserve" language="perl">
56
# Jim Menard jimm@{bbn,io}.com (617) 873-4326 http://www.io.com/~jimm/
58
$nBottles = 100 if $nBottles eq '' || $nBottles < 0;
60
foreach (reverse(1 .. $nBottles)) {
61
$s = ($_ == 1) ? "" : "s";
62
$oneLessS = ($_ == 2) ? "" : "s";
63
print "\n$_ bottle$s of beer on the wall,\n";
64
print "$_ bottle$s of beer,\n";
65
print "Take one down, pass it around,\n";
66
print $_ - 1, " bottle$oneLessS of beer on the wall\n";
71
<para>Origin: http://www.99-bottles-of-beer.net/language-perl-539.html</para>
72
<para>Some additional examples</para>
73
<code xml:whitespace="preserve" language="perl">
79
I wish you to leave Sunnydale and never return.
89
I wish you to leave Sunnydale and never return.
99
I wish you to leave Sunnydale and never return.
b'\\ No newline at end of file'