#!/usr/bin/perl
while (<>) {
chomp;
$_ = $prevline . $_;
s[.*?(
|$)][$1];
if ( s[.*(.*\.).*][$1] ) { # Match dgfdgfdgdythghgrw. and keep from to but not including .
if ( m[(.*)
] ) { push @zones, $1; };
s[.*
(.*)\.][$1]; # Strip out zone
s[\s+][ ]g; # Compress whitespace
foreach $critter (split /[,]/) {
$critter =~ s|^\s*(.*)\s*$|$1|;
$critters{$critter} .= " " x (@zones - length($critters{$critter}));
substr($critters{$critter},@zones-1,1)="x";
}
}
}
continue {
$prevline = $_;
}
print "Gloranthan Creature Distribution
\n";
print "\n";
print " | \n";
foreach $zone (@zones) {
$_ = $zone;
s|[ '/]||g;
$_ = lc;
print ' | ', "\n";
}
print "
\n";
foreach $critter (sort keys %critters) {
$zones = $critters{$critter};
print "\n";
print "| $critter | \n";
$zones .= " " x (@zones - length($zones));
@cells = split /=*/, $zones;
foreach $_ (@cells) {
s/ /\ /;
print "",$_," | \n";
}
print "
\n";
}
print "
\n";