The following is an example of syntax highlighting through xslt using xslthl . The following Xslt processor was used: SAXON 8.7 from Saxonica ( http://www.saxonica.com/ )

Perl code

Example Perl code

		
#!/usr/bin/perl
use strict;
use warnings;

#######################################
#
#   99 bottles of beer on the wall
#   Written in object oriented Perl
#
#######################################
my $beer = Bottles->new();
$beer->Take_One_Down() while $beer->Remaining();

package Bottles;

sub new
{
	my $bottles = 99;
	bless \$bottles;
}

sub Take_One_Down
{
	my $self = shift;	
	my $s = $$self == 1 ? '' : 's';
	
	print "$$self bottle$s of beer on the wall,\n";
	print "$$self bottle$s of beer.\n";
	print "Take one down, pass it around.\n";
	
	$$self--;
	
	$s = $$self == 1 ? '' : 's';
	
	print "$$self bottle$s of beer on the wall.\n\n";
}

sub Remaining
{
	my $self = shift;
	return $$self;	
}
		
	

Origin: http://www.99-bottles-of-beer.net/language-perl-648.html

Alternative

		
#!/usr/bin/perl
# Jim Menard     jimm@{bbn,io}.com     (617) 873-4326    http://www.io.com/~jimm/
$nBottles = $ARGV[0];
$nBottles = 100 if $nBottles eq '' || $nBottles < 0;

foreach (reverse(1 .. $nBottles)) {
    $s = ($_ == 1) ? "" : "s";
    $oneLessS = ($_ == 2) ? "" : "s";
    print "\n$_ bottle$s of beer on the wall,\n";
    print "$_ bottle$s of beer,\n";
    print "Take one down, pass it around,\n";
    print $_ - 1, " bottle$oneLessS of beer on the wall\n";
}
print "\n*burp*\n";
		
	

Origin: http://www.99-bottles-of-beer.net/language-perl-539.html

Some additional examples

		
print <<"END";
 
Dear $recipient, 
 
I wish you to leave Sunnydale and never return.
 
Not Quite Love,
$sender
 
END

print <<'END';
Dear $recipient,
 
I wish you to leave Sunnydale and never return.
 
Not Quite Love,
$sender
END


print <<END;
Dear $recipient,
 
I wish you to leave Sunnydale and never return.
 
Not Quite Love,
$sender
END		

fin
		
	

Generated by: SAXON 8.7 from Saxonica ( http://www.saxonica.com/ ) - Xslt version: 2.0