use strict; use warnings; use Path::Class; my $rootdir = ... # however it happens my $relative_path = file($0)->relative($root_dir); # btw, this does the same if all you want is # the script name: use FindBin; my $name = $FindBin::Script; # there's also $FindBin::Dir, ::RealDir and ::RealScript, # the last two are only relevant for resolving soft links. # Here's Yet Another Way, using Path::Class again: my $script = file(__FILE__)->basename; # If you want to be thorough... $script = file(__FILE__)->absolute; $dir = $script->dir; $script = $script->basename; #### use strict; use warnings; use HTML::ElementTable; my @back_row = qw(rook knight marshal bishop cardinal queen king cardinal bishop marshal knight rook); my @middle_row = qw(pawn squire squire novice priest princess prince priest novice squire squire pawn); my @front_row = (undef, ('pawn') x 10, undef); my $t = HTML::ElementTable->new(maxrow => 11, maxcol => 11); for my $c (0 .. $#back_row) { $t->cell($_, $c)->push_content($back_row[$c]) for (0, 11); } for my $c (0 .. $#middle_row) { $t->cell($_, $c)->push_content($middle_row[$c]) for (1, 10); } for my $c (0 .. $#front_row) { next unless $front_row[$c]; $t->cell($_, $c)->push_content($front_row[$c]) for (2, 9); } for my $r (0 .. $t->maxrow) { for my $c (0 .. $t->maxcol) { $t->cell($r, $c)->attr(class => $r % 2 ^ $c % 2 ? 'odd' : 'even'); } } print $t->as_HTML;